Navigation Keys for Terminal Apps

I’m (re)learning Vim after a long hiatus, and also on the beginners curve with i3 window manager.

After some study and deliberation, I have chosen to remap Vim’s navigation keys from hjkl to jkl;

My rationale is that I already touch-type fairly well, and I don’t want to learn a second “default” positioning of the fingers that is slightly different (but just enough to be confusing) and makes no ergonomic sense.

There is already precedence for this: i3 also uses jkl; because of the consistency with touch-typing.

The hjkl pattern derives from a keyboard that is long obsolete.

References:

  1. http://stackoverflow.com/questions/3083928/vim-remapping-the-hjkl
  2. http://i3wm.org/docs/refcard.html
  3. https://faq.i3wm.org/question/704/why-does-the-default-config-use-jkl-instead-of-hjkl/

For the insanely curious, here is the key-mapping section of my .vimrc:

"------------------------------------------------------------
" Mappings

" Map the navigation keys to be consistent both with touch-typing and i3
noremap ; l
noremap l k
noremap k j
noremap j h

" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
map Y y$

" F12 to run Autoformat
map <F12> :Autoformat<CR>

" Type a number followed by CR to jump to that line, and
" CR by itself to jump to last line.
nnoremap <CR> G

" e to open Vexplore (explorer, split always, left/right)
noremap e :Vexplore<CR>

" s to mean save (not insert)
noremap s :w<CR>

" zz to mean save and exit
noremap zz :wq<CR>

" qq to mean quit-no-save
noremap qq :q!<CR>

" w to move between windows
noremap w <C-w><C-w>

" Ctrl-j and Ctrl-; to move left and right between words while
" in INSERT mode
:inoremap <C-J> <C-\><C-O>b
:inoremap <C-;> <C-\><C-O>w

"------------------------------------------------------------
2 Likes

Glad to hear, long live vim

1 Like