3 ms·
If anyone is apprehensive about vim's hjkl keys, and you like the arrow keys better, you can use ijkl instead and get all the benefits of the muscle memory you
by ehsanu1 15y ago
If anyone is apprehensive about vim's hjkl keys, and you like the arrow keys better, you can use ijkl instead and get all the benefits of the muscle memory you have built up for arrow keys, while still keeping your hands on the home row. Use this mapping:
" remap h to i and use ijkl for inverse T cursor movement
map k g<Down>
map i g<Up>
map j <Left>
noremap h i
Then the 'i' key will be replaced by 'h'. So press 'h' to insert, or for inner selections, instead of 'i'. Also note the 'g' for up/down motions, which means it won't skip the wrapped part of lines - just remove the 'g' if you don't like that.
If you're worried this breaks anything else, I've had this interfere with just one other thing: a plugin that let me select text based on indentation of the line the cursor was on, but I made a few minor changes to the vimfile for the plugin and fixed that pretty easily. The other thing is that random servers won't have these mapped, but just copy the config over if you'll be doing a lot of text editing on that server. Otherwise, you can just fall back to using hjkl awkwardly.
- sciurus 15y agoI'd recommend the opposite. If you're apprehensive about hjkl, force yourself to use it anyway! " disable arrow keys nnoremap <Up> <nop> nnoremap <Down> <nop> nnoremap <Left> <nop> nnoremap <Right> <nop>
- ehsanu1 15y agoI didn't advocate using arrow keys, but rather using ijkl. Your suggestion is not mutually exclusive with my own, you can do both. :) Though I guess the mappings I provided would have to be noremap instead of map.
- graywh 15y agoI'd recommend specifying a mode on those. That i map disables half the text-objects in visual and operator modes.
- ehsanu1 15y agoI still use those text-objects, just with h instead of i. This is required because otherwise, you'll have issues when trying to move in visual and other modes.