Hacker News new | comments | show | ask | jobs | submit login

Put in your vimrc:

    " disable arrow keys
    map <up> <nop>
    map <down> <nop>
    map <left> <nop>
    map <right> <nop>
    imap <up> <nop>
    imap <down> <nop>
    imap <left> <nop>
    imap <right> <nop>

I'm curious, do you keep this around to this day? I never thought to do this when I started, but it might have been a good idea.

In similar vein I would say: If your fingers aren't constantly resting on home row, there's a problem.

Another advantage learning to use hjkl is that those keys are common in other unix programs, like less for example (which also has gg, G, / and some others)

I disabled the arrow keys when I started getting serious about vim last year. To give you an idea of how much it helps: when I openned my vimrc to copy this out, I was surprised that these lines were not commented out...

There are also web applications where hjkl work as well, like Gmail and Google Reader.

This is actually a huge pain for me.

I should have mentioned that another thing that can get you more intimate with vim keyboard shortcuts is trying out one of the vim browser plugins. I use vimium on chrome and vimperator on FF. These give you a number of the keys you're used to using in vim like gg, G, and even / search.

Gmail binds those keys, but I'm so used to scrolling up and down with j/k that the action Google chose is infuriating. What's worse is that turning the keyboard shortcut option off in gmail still captures the key press event, but silences it, effectively breaking my favorite plugin.

They offer 'basic html' mode, which turns off the bells and whistles (and makes it load much faster). It plays much more nicely with vimperator that way.

with vimperator you can press ctrl+z to enable pass-through mode, therefore allowing you to use the gmail shortcut keys, press escape to go back to normal mode.

Thanks for the heads up. That is quite convenient, unfortunately I'm now using vimium. I'm reminded that in my vimperator days gmail wasn't a problem because the vi key bindings just worked everywhere. All this is moot considering I can just patch the plugins. I assume vimium either has a similar capability or that it can easily be added, but it does allow a web app to trap key strokes before by default (opposite of vimperator)

Unfortunately, unless I can rebind those keys, such short-cuts are totally irrelevant for people who actually care about comfort and speed: H, J, K, and L are not aligned at all in my ergonomic layout.

Similarly, forcing yourself to stay out of insert mode is a huge help when learning vim:

   " Automatically leave insert mode after 'updatetime' (4s by default)
   au CursHoldI * stopinstert

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact