Master the HJKL navigation with the Vim plugin Hjklmode, which can help breaking the habit of moving the right hand away from the home row

5/5

Vim’s popularity is largely due to its ability to increase productivity through efficient navigation and editing techniques. One such technique is HJKL navigation, which allows using the H, J, K, and L keys to move the cursor left, down, up, and right. This method of navigation may seem strange at first, but it is actually a very efficient way to navigate through text and can greatly increase productivity when using Vim.

In addition to that, the HJKL navigation can help reduce wrist strain, as it allows moving the cursor without having to reach for the arrow keys, which are located in a position that can cause wrist to bend and flex in an unnatural position.

However, HJKL navigation can be hard to learn at first, because it requires using unfamiliar key combinations to move the cursor. One way of making it easier to learn HJKL navigation is by using the Vim plugin Hjklmode, written by James Cherti. You can use the Vim plugin to force yourself to rely on HJKL navigation to move around the text.

If you are interested in trying the Hjklmode Vim plugin, you can download it from its Git repository: https://github.com/jamescherti/vim-hjklmode

Hjklmode Vim plugin features

One of the key features of the Vim plugin Hjklmode is its ability to disable certain keys that require moving the hand away from the Touch Typing position, which can disrupt typing flow. These keys include: Backspace, Insert, Delete, Home, End, Page Up and Page Down, Arrows.

In addition to disabling certain keys, the Vim plugin Hjklmode also adds key mappings for Alt+h, Alt+j, Alt+k, Alt+l to Insert Mode, Command Mode, and Terminal Mode, which allow moving the cursor even in those modes.

Overall, the Hjklmode Vim plugin is a great tool for those looking to learn the HJKL navigation to increase their efficiency and productivity. Whether you are a beginner or an experienced Vim user, the Hjklmode Vim plugin can help you break the habit of moving your hand away from the home row/Touch Typing position.

Do you like the Vim plugin Hjklmode? Please add a star to vim-hjklmode on GitHub.

Install the Vim plugin Hjklmode with Vim’s Built-in package manager (Vim 8 and above)

mkdir -p ~/.vim/pack/jamescherti/start
cd ~/.vim/pack/jamescherti/start
git clone --depth 1 https://github.com/jamescherti/vim-hjklmode
vim -u NONE -c "helptags vim-hjklmode/doc" -c qCode language: JavaScript (javascript)

(The plugin can also be installed with any third-party plugin manager such as Pathogen or Vundle)

What are the alternatives to pressing the Escape, Backspace, and Arrow keys?

Built-in Vim Key MappingEquivalent to
Ctrl-[Escape
Ctrl-hBackspace
Ctrl-fPage down
Ctrl-bPage up
hLeft
jDown
kUp
lRight
0 (zero)Home
$End

For more information:

  • :help motion.txt
  • :help search-commands