Hey IH! 👋
Recently, I've been wanting to learn Vim.
Why? Because I want my workflow to be more efficient + many devs have nothing but good to say about it. 😊
So, I told my brain:
Over the past hour or so I've learned some basic skills and customized Vim just a bit.
I've searched up tutorials for Vim on how to make customize it the best, and if I should use something like NeoVim or Kate... but it's a lot to take in. 😅
Are there any devs who are pretty used to Vim that could help me out here?
A little background on myself:
Any help is very much appreciated 🤗
There are quite a few videos of people showing you the basics of using Vim. I don't remember which ones I watched, but it's useful to see how others navigate quickly around the file. I was an emacs user for probably more than decade but I got tired of "emacs pinky" so I decided to try Vim. I haven't looked back since.
I still use IDEs like Xcode (required, really for autocomplete), but when editing markdown or just general text I use Vim.
I recommend having a cheatsheet handy when you first start. When you encounter something you want to do but don't know how, look it up and then add it to the cheatsheet. Keep going until it becomes muscle memory.
I think it took me a few weeks before I felt like I could get around a file quickly.
Thanks for the tips @allenu. I've only used Vscode. How does it differ from Vim (If you've tried vscode out before)?
I'm not sure when I should use Vim if I jump between multiple files frequently.
Well, the main difference is it uses "modes". It's not like other editors where you're live editing things. You enter commands to move around the file, find text, select text, replace text, etc. You have to go into the edit mode to modify the text contents.
Once you get good at it, you start thinking in terms of strategies to reduce your keystrokes, like how do you move down to that line with the quoted text and change the contents of the quoted text without having to manually move the cursor.
For instance, if I see quoted text on a line, I can just type c i " on the keyboard and it'll select and edit the text inside the quotes. No need to use the mouse or cursor keys to select and delete the text manually.
Nice. I'll definitely have to give it a try. Thanks for your help!
Hey @BraydenTW. I've been using vim for ages, and it's awesome, I can share my setup with you.
BUT. If your goal is to keep developing frontend apps, I cannot escape the notion that vscode seems to be a bit better. Case to the point: https://www.youtube.com/watch?v=gnupOrSEikQ&t=3s, Ben Awad showing how to configure vim similar to vscode; but he concludes that vscode is still better for him personally.
Just my cents.
Thanks. I’ve been wondering the same thing and was going to watch Ben’s video soon.
If there is a way you can share your rc file (GitHub or other way) that would be great.
Sure thing. All my configs are at gitlab.com/alourie/dotfiles; you'll find I'm using neovim with a config at ~/.config/nvim.
The main config (init.vim) is built as a collection of included files, each for an area of configuration (I stole the idea from someone on the internet). I have comments for each included file there, so feel free to steal it/reuse it.
When you launch neovim for the first time, ignore errors as it initially needs to install all the plugins (for example, the colour schemes are plugins too, so it will initially complain about those not present); but from the consequent launches, it should be fine.
Shoot any questions you might have, I'll be more than willing to help you out.
Cool - thanks for your help! I'll let you know.
I recommend getting the basics right first. There's a lot of plugins and and .vimrc tweaks that can help you in the long run but before diving into those, get to know what Vim offers out of the box. Otherwise, your workflow quickly gets messy.
"Practical Vim - Edit Text at the Speed of Thought" is a book that helped me a lot getting started with Vim.
Good luck!
Cool! Thanks for the tips. 😄
Good luck! I know the path you are taking very well, took a me a long time to switch to Vim back in the day, not an easiest thing to do. But eventually if you persist you will not regret learning Vim, honestly you might not ever want to use other editors again.
I don't consider Vim to be an editor, I call it an editor builder. You will build your own perfect editor using Vim, which will take some time. Browse for other peoples vim configurations on github, copy-paste snippets which you find interesting and learn them one by one, expect it might take months till you're proficient enough to use vim as your daily editor. For example here is my neovim config.
One more thing, let me share an article from Yehuda Katz which helped me a great deal initially, there's a lot of information on the internet and people telling you do this or that. It an old article but the message is still true today.
Everyone Who Tried to Convince Me to use Vim was Wrong
However I also love vscode and all it’s benefits. I’ve heard from @Glazy that vscode has an extension for him keybindings. I’ve tried them out and they’re pretty great.
Should I stick with that setup or should I try out something like neoVim?
I've heard as well and it runs actual neovim underneath which is pretty cool! On the other hand, for me, neovim does everything that VSCode does and it's UI is perfect, so running a hybrid of both with two sets of keybindings kinda makes sense to me only to learn a bit of vim at your own pace (instead of being forced to learn all at once which is hard). But take this as my personal opinion only, everyone is different. For me learning Vim was the best thing ever, back then there was VSCode and I was switching the editor every year or two. Now it's a problem solved once and for all for me.
Thanks for your help @mikekreeki! Super useful advice! 👏
Thank you so much Mike!
I think that is a good goal I can make this year.
You mentioned you're familiar with VSCode and have always used it - have you tried using any of the extensions that add Vim keybindings to VSCode?
No - I haven’t yet. If I love vscode so much, should I learn vim and keep using vscode with the vim keybindings? Would it be easier to use that instead of all Vim?
Absolutely. Vim can be overwhelming at first so keeping your UI, configuration, etc the same as you're used to is only going to make things easier.
I've used both NeoVim and Doom Emacs extensively but, for one reason or another, always find myself back at VSCode!
Haha - thanks! I'll try these over the next coming weeks! 🤞
I applaud your choice and wish you all the best in your 10 year quest of mastering vim.
Since you didn't ask any specific question I will simply say:
Thanks for your kind words. 😊
I started vimtutor yesterday and I like it a lot. I’ll try out VimGolf too.
Thanks again!
shortcutfoo.com - find vim
Thanks! That's a pretty neat website :D
I've found these interactive VIM tutorials to be helpful:
Cool - thanks for sharing!
I highly recommend checking out The Primegean on YouTube.
Cool - I'll check it out. Thanks!
Hey, I started with Vim recently, coming from VSCode as a frontend developer like you.
I highly recommend SpaceVim, it's like a plug and play distribution of Vim with common plugins already in it, In my opinion the first thing you need to develop is muscle memory and improve your workflow with it, and avoid going crazy for have a usable basic Vim
Doom-Emacs is also a good option.
Thanks! I'll check those resources out. I'll let you know how it goes :D
Your best friend is vimtutor.
As for NeoVim vs. Vim, NeoVim has some features that make plugins faster. If you use lots of plugins, you may end up reaching for NeoVim, but you're probably fine with Vim to just get started.
Thanks. I started using VimTutor a bit ago and I love it. It's a super helpful way to get started.
Just for fun, I tried setting up NeoVim. However, when I typed the command
nvim
into my terminal inside the directory I want, it just shows a blank screen. Everything is installed correctly.Did you encounter something like this when you first started NeoVim?
You might like VimTricks
Haha how could I forget 😅
Thanks for reminding me!