Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

If only I had read this when I first started using Vim!

I've been using Vim for a while, and this is one of the best-organized overviews of Vim I've seen, partly because he doesn't try to enumerate every single key combination (which is the wrong way to learn Vim - the right way is to synthesize the way that the individual operations are logically combined, though that admittedly takes some time). The best two pieces of advice he gives are (1) not to put anything in .vimrc without knowing exactly what it does, and (2) don't use too many plugins.

At this point, I actually don't think I really use any plugins regularly. I have nothing against Vim plugins in general. It might be a bit faster to install a choice few, sure, and someday I might try and figure out which ones work best for me. But for the time being, I'd much rather know how to navigate my file or project with just the standard set of operations and minimal configuration. That way, I can launch Vim on any machine and start using it, without needing to waste time setting it up just so I can use it properly.

(Disclaimer: I have mapped Caps Lock to Esc, which is indeed a major problem if I use another person's computer. I've gotten used to seeing "E492: Not an editor command: W" practically every time I type on a friend's laptop. But it saves me so much time when working on my own machine that it's worth it!)

In short: stick with Vim long enough, and you'll find that you don't really need many plugins or much configuration for it to be incredibly useful. They help, but not as much as you might think, especially once Vim's standard keybindings become part of your keyboard reflexes.



I agree about accepting (most) standard key bindings, but here are two clever bindings I adopted:

  " Enter command mode with SPACE instead of :
  noremap <Space> :

  " Exit insert mode with jj (double J) instead of ESC
  imap jj <Esc>


I used jj for a while as well, but once I found out that ctrl-C did the same thing out of the box, that became my "esc" key> (it's also important to remap caps lock to control, on the mac its easy: System Preferences->Keyboard->Keyboard->Modifier Keys)


Note: that isn't exactly the same--using Esc will trigger InsertLeave autocommands, Ctrl-C will not.


imap <c-c> <esc>

Now it does.


As graywh says, ctrl-c is not the exact same as escape. If you want something standard which is, try ctrl-[. Harder to type, I know.


What about changing hjkl movements to jkl;? I didn't try it yet... But hjkl bothers me. My index belongs on j, for homerow touch typing, not h. Wouldn't it be an improvement? Not having to move the hand for movements. I must be missing something because everyone stays with hjkl.


The keys I use most are up/down. I tend to move between lines more often than I move between characters. This is true in any editor, but especially in vim, since I almost never move between individual characters, but rather use [w]ord movement commands, or [f] commands, etc.

That's why it makes sense that my strongest fingers are on the up/down motions, whereas to move to the left, a movement I never make, is off to the side.

Also, I wouldn't remap it for practical reasons - hjkl is a standard implemented in many places.


I did this for about two months before switching back to hjkl. There are two reasons why I switched back:

* I like using "Ctrl+Direction" to move around splits, and mapping Ctrl+; on a Mac doesn't work without some Keyremap4Macbook trickery. It's a pain to get working.

* Tons of other stuff uses Vim bindings, and you can't usually remap keys in most other programs.


I'm much faster in vim since I gave up (for the most part) on hjkl (arrow keys are banned for obvious badness). / ? # * combined with f and t are so much faster. The only time I use j/k is 10j/10k for looking through files.

Hence, your question is somewhat misguided ;)


And what country is your keyboard from?

Unless you mean you specifically use search for every motion...?


I use colemak now, but this holds true in qwerty as well (most of the time). I don't use search for EVERYTHING, just most of the time it's faster.


I use backspace as a substitute for ESC. I find ESC awkward to locate while typing, but backspace is easy.


don't forget about:

  let mapleader = ","
it remaps <leader> to ',' instead of '\'


Hi, no need for remapping of any keys if you are after Esc. Just type Control-[, it generates Esc by default.


Literally typing Ctrl+[ works for escape by default, it's what I've been doing instead of trying to remap keys.


my one indispensable plugin is matchit.vim, which does % matching between paired tokens like do/end, or <div>/</div>




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: