Learn Vim Progressively. The key is, get the basics down, then gradually learn more. Vim is not a, read the manual once and master it, but rather a 10 year plan. It’s old and odd at first, but the odd is there for good reasons.
G Back to our question
Why Vim, what do yo like so much about it?
Here are a few of the features of Vim I use everyday, that make my life so much easier. Some of these you can find in other editors, but Vim really shines.
Let’s say you have some code like such: var song = "I'm a little tea pot";
, and you want to replace it with var song = "We will, we will, rock you"
. In Vim you simply place your cursor inside the quotes and press ci"
. This means Change (c)
, In (i)
, Quotes (")
. This will clear out everything inside the "
and you can begin typing what you want.
This works for any enclosing characters, ()
, []
, ''
; would be ci(
, ci[
, ci'
respectively.
Getting around in Vim is very quick. Use w
or W
to jump words. Use e
or E
to jump to the end of words. Use ft
to jump to the next occurrence of t
in the current line. Use $
to just to the end of the line (yeah, just like in RegExp). Try G
to go to the bottom of the file, or Ctrl + o
to go back to where you were (even in other files).
This isn’t monumental, but you can type /hello
and it will find Hello and heLLo and hELL0, but if you type /Hello
, it only find Hello, not hello. That’s because as soon as you type of capital, it turns into case sensitive.
There are way too many plugins to cover them, but suffice to say here are a few that I use and depend on.
.
Let’s say you type something like I just did https://github.com/
. One you do that you can use the .
to do that over and over anywhere. Move to different location, then press .
, it inserts https://github.com/
.