Skip to content

Instantly share code, notes, and snippets.

@bpierre
Last active February 15, 2024 18:40
Show Gist options
  • Save bpierre/0a0025d348b6001394e0 to your computer and use it in GitHub Desktop.
Save bpierre/0a0025d348b6001394e0 to your computer and use it in GitHub Desktop.
Switch To Vim For Good

Switch To Vim For Good

NOTE: This guide has moved to https://github.com/bpierre/switch-to-vim-for-good

This guide is coming from an email I used to send to newcomers to Vim. It is not intended to be a complete guide, it is about how I switched myself.

My decision to switch to Vim has been made a long time ago. Coming from TextMate 1, I wanted to learn an editor that is Open Source (so I don’t lose my time learning a tool that can be killed), cross platform (so I can use it everywhere), and powerful enough (so I won’t regret TextMate). For these reasons, Vim has always been the editor I wanted to learn, but it took me several years before I did it in a way that works for me. I tried to switch progressively, using the Janus Vim distribution for a few months, then got back to using TextMate 2 for a time, waiting for the next attempt… here is what finally worked for me.

Original gist with comments: https://gist.github.com/bpierre/0a0025d348b6001394e0

Non Optional

  1. Watch the Derek Wyatt videos in order (at least the “Novice” ones for now): http://derekwyatt.org/vim/tutorials/
  2. Read the first part of this Stack Overflow answer: http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118
  3. Read “The Problem with Vim”, just to warn you: http://haldean.org/vim-problems/
  4. Launch vimtutor and finish it. Start playing with your new editor.
  5. Read “How to Switch to Vim” by David Bryant Copeland (entirely): http://naildrivin5.com/blog/2013/04/24/how-to-switch-to-vim.html
  6. Read “Coming Home with Vim” by Steve Losh (entirely): http://stevelosh.com/blog/2010/09/coming-home-to-vim/

My Advices

  • Start with an empty .vimrc, no plugins, no Vim distribution (like Janus). Only add what you understand, do not add too much things at once. Read other people .vimrc files. Vim is about “building”, or configuring, your own editor.
  • Do NOT stay in edit mode! The “normal” mode is called like that for a reason: you should stay in that mode most of the time. Switch to insert mode, insert something, then go back to normal mode.
  • Put your .vimrc on a repository hosting service (Gitlab, Bitbucket, GitHub…) so you can easily use it from everywhere and share it with others.
  • Create your own commands everytime you see yourself doing the same thing again and again, especially when entering in command line mode (by pressing :). Start by mapping :w to something faster to type. For me it’s ,s, because , is my <Leader> key, and s is always under my opposite hand.
  • Vim is a game which is incredibly rewarding after the first learning phases. You will learn to speak to your editor using a language. Every time you will learn a new noun, you will be able to use it with any verb or adjective that you already know. That is why with the time, every small thing you learn will be more and more powerful.
  • Try to learn new tricks from time to time, and remember to practice them so your brain can assimilate them and use them without even thinking about it.
  • Forget about your arrow keys. If you use them, your brain will never develop any good moving habit. Try to not use hjkl too much. kkkkkllllllllll is not faster than using a mouse: if you repeat the same key more than 3 times, there should be a way to move faster. Find it and use it.
  • If you more or less plan to buy a new keyboard, do it. This keyboard is now your Vim keyboard, and that could help you to create a mental switch.
  • You won’t be as productive as with your previous editor until one or two weeks, depending on what you do. Commit. Don’t look back. Your brain will hate it, but don’t listen to him, he will quickly find a way to be productive again.

Other Things

Another approach that seem to work for some people is to take the opposite way: slowly learning Vim by using it as a “normal editor” to start. It didn’t work for me, but maybe it could work for you: http://yehudakatz.com/2010/07/29/everyone-who-tried-to-convince-me-to-use-vim-was-wrong/

@FranckErnewein
Copy link

It's a good point to start to use vim from scratch and learn basics at first.
But people should start to use a plugin manager like Pathogen or Vundle as soon as they understand how plugins work.
I strongly increased my vimrc since I started to use it.
vim with git is awesome

@Dinduks
Copy link

Dinduks commented Jun 24, 2015

Forget about your arrow keys.

I disabled them when I started learning VIM, and kept them disabled until now: https://github.com/Dinduks/dotfiles/blob/master/.vimrc#L77

Try to not use hjkl too much

Seriously?
I don't think that's what you mean, maybe you should rephrase that. 😄

kkkkkllllllllll is not faster than using a mouse: if you repeat the same key more than 3 times, there should be a way to move faster. Find it and use it.

Yes, and a mouse is not faster than using f, t, F, T, e, b, etc. :)

Nice post. Cheers!

@iKlsR
Copy link

iKlsR commented Jun 24, 2015

I wrote a small rant a little while ago on your first point under advicehttp://ricardolovelace.com/blog/2015/01/11/vim-is-not-a-black-box/

@erikbgithub
Copy link

I really like the idea of starting without plugins and a stolen config. There's a lot of power in vim already. Some problems are solved differently than a typical IDE would do it. Remember, you put energy into learning vim because being 10% faster is not enough for you, you want to be 10x faster. For people who just want to be 10% faster it's probably better to just learn more about the IDE they already know.

I'd argue the same for nnoremap stuff that is often suggested. First learn the real hotkeys. Only months or years later start to set them to other keys. If you start too early you will start to remap things that actually make sense once you wrap your head around a few ideas. And even when you start to remap a lot (after years) you can still use your well trained standard-key memory to write the mappings faster.

@cincodenada
Copy link

Try to not use hjkl too much

Seriously?
I don't think that's what you mean, maybe you should rephrase that. 😄

kkkkkllllllllll is not faster than using a mouse: if you repeat the same key more than 3 times, there should be a way to move faster. Find it and use it.

Yes, and a mouse is not faster than using f, t, F, T, e, b, etc. :)

@Dinduks, I think you're missing the author's point, and inadvertently reiterating it. You shouldn't use hjkl too much. @bpierre's whole point is that if you're leaning on l repeatedly to get around, you should probably be using $, w, f, %, etc. instead.

He's saying use hjkl instead of the arrow keys, of course, but don't misguidedly stick with them to move massive distances just because it's "faster" than moving to the mouse. If you're just using hjkl to move halfway across the document, you might as well just use the mouse - but instead, learn the movement commands that will actually get you there faster.

@bpierre
Copy link
Author

bpierre commented Jun 25, 2015

@cincodenada Exactly my point. Thanks for clarifying it!

@bpierre
Copy link
Author

bpierre commented Jun 25, 2015

@FranckErnewein

But people should start to use a plugin manager like Pathogen or Vundle as soon as they understand how plugins work.

Agree, that’s why “How to Switch to Vim” is in the list.

@tinyheero
Copy link

This is absolutely fantastic. Great guide.

@jryio
Copy link

jryio commented Jun 29, 2015

Recent Vim convert, very happy to have found this. Still working on recognizing my most used keys and remapping them to simpler key combinations.

As @cincodenada aptly put it, there are much faster alternatives to hjkl, so I'm still learning how to use them effectively.

Loving Vim so much already!

@bpierre
Copy link
Author

bpierre commented Jan 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment