DEV Community

Cover image for Vim isn't for everyone. Here is how to make it yours
Chris Chou
Chris Chou

Posted on • Edited on

Vim isn't for everyone. Here is how to make it yours

Did I say Vim isn't for everyone? I certainly felt that way the first couple of time I tried it. After several failed attempts over the years, I finally made Vim my daily driver. Below I have a couple of tips from my own experiences for people starting out on Vim/Neovim.

  1. Start small, really
    Too much too quickly is a common theme in my past failures trying to learn Vim. Only 6 keys are needed to move the caret left (h)/right (l)/up (k)/down (l), delete (x) and insert text (i). It took me 2 weeks to get comfortable with just the aforementioned 6 keys and weaned myself from reaching for the mouse.

  2. Use Vim now
    There is practically no need to setup Vim for use in terminal or GVim (Vim in a window) initially. Most editor/IDE has a Vim emulation waiting to be enabled.

  3. Avoid using it under pressure initially
    Professional work is hard enough as is without adding Vim to the mix. I got much more successful when I used Vim on my personal project, which I simply enjoy the experience with what I already knew or add one or two commands in a session. I manage to slowly but steadily expand my Vim muscle memory over weeks this way.

  4. Touch typing is important
    Touch typing is almost a prerequisite. I have never seen anyone use Vim well without being able to touch type fairly accurately. Weakness in my touch typing flared up when using Vim and I added 5 min of targeted typing exercises at the start of a session until I was comfortable.

  5. Experience default key mapping first before customisation
    Some advocate promote customisation early on, citing inefficient key mapping creates bad muscle memory, resulting in a long term impact on productivity. However, I find the default key mapping adequate for most tasks, particularly with Neovim. I also don't like to customise until the keymap really bugs me and the keymap I find more comfortable with is not already taken by something useful.

Above are some of what I felt worked for me after a number of failed attempt to learn Vim in the past. I now keep a learning-sheet I made with the commands I want to learn. When I got the command sequence stored in muscle memory I will delete it from my learning-sheet to keep it up to date.

Happy Vim-ming!

Top comments (8)

Collapse
 
snowleo208 profile image
Yuki Cheung

I have my own list of plugins in Vim, but I was so used to graphical interfaces that, every time when I try to cut and move a long snippet to different place, I feel I cannot do that in Vim well. That's very annoying. :(

But Vim is really fast! Still thinking how to use Vim instead of VSCode.

Collapse
 
chhschou profile image
Chris Chou

I think the transition for me is graphical -> shortcut keys -> vim commands. I already knew how to do quite a bit with shortcut keys (like ctrl + c for cut and ctrl + v for paste) before I started vim. Some of my first wins with vim are by replacing the shortcut keys I normally use with vim commands (like x for cut and p for paste). This got me feeling productive pretty quickly.

Collapse
 
stevetwitte profile image
Stephen Taylor Witte

Great tips, I agree with them all and love Vim as well. For anyone looking to learn I highly recommend the now free Upcase course Onramp to Vim.

It is available here: thoughtbot.com/upcase/onramp-to-vim

They also have a great video on Neovim and Vim 8 as well as one on using the terminal effectively.

Collapse
 
dzuvan profile image
Јован Хрњак • Edited

What really helped me when I started with vim was to disable arrow keys in .vimrc, took me a couple of days to get used to it, but everything was much easier after that :D

Collapse
 
ondrejs profile image
Ondrej

Vim rocks. 10x better and faster than electron-based bloatware like VSCode or Atom.

Collapse
 
chhschou profile image
Chris Chou

I agree it is much faster, although I felt the speedup does not completely outweighs the other things VSCode has, like a debugger, and the huge ecosystem of quality extensions. If you work with technology like TypeScript VSCode makes it really nice with all the functionality provided by the language server. Overall I could jump into a file with vim and edit away, I do this with documentation (in markdown) and git workflows a lot. For navigating a large codebase and figuring out what I need to do I would open VSCode/WebStorm.

Collapse
 
pizmovc profile image
Luka

I've always wanted to use it, but in the end couldn't go trough with it. Currently I use it as git commit message editor and in the terminal, but my daily driver is still VS Code.

Collapse
 
chhschou profile image
Chris Chou

I use the VSCodeVim extension in VSCode (marketplace.visualstudio.com/items...) as my daily driver. It isn't perfect Vim but pretty close for most of what I want to do. Once the extension is installed you can toggle vim mode on/off via the VSCode command menu (ctrl + shift + p then type toggle vim mode). It should hopefully be less daunting than vim in the terminal.