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.
The Vim plugin hjklmode can be used to:
- Learn HJKL navigation: Hjklmode forces you to learn HJKL navigation as it disables certain keys that require moving the hand away from the Touch Typing position, which can disrupt typing flow. These keys include: Backspace, Arrows, Insert, Delete, Home, End, Page Up and Page Down.
- Add HJKL navigation to other modes than Normal Mode: Hjklmode adds the key mappings \
+hjkl to Insert Mode, Command Mode, and Terminal Mode.
Hjklmode does not disable the Escape key by default. It can be disabled with the option let g:hjklmode_disable_escape = 1 . It is important to note that Hjklmode ignores the option g:hjklmode_disable_escape when Vim is executed in a terminal or on the Windows operating system.
How to make Alt+hjkl work in Terminal Mode?
Hjklmode adds key mappings for \
It works well in Vim GUI mode (gvim), but does not always work when Vim is executed in a terminal.
You can make the key mappings \
Do you like Hjklmode?
Please star vim-hjklmode on GitHub.
Installation
Installation 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 q
Installation with a third-party plugin manager
You can also install this Vim plugin with any third-party plugin manager such as Pathogen or Vundle.
How to enable Hjklmode by default?
Add the following variable to “~/.vimrc”:
" Disable the menu bar because it may prevent you from using the Alt key
set guioptions-=m
" Enable Hjklmode by default
let g:hjklmode_enabled = 1
" It is recommended to not disable the Escape key.
" Disabling the Escape can cause issues with macros.
let g:hjklmode_disable_escape = 0
How to enable Hjklmode manually?
:HjklmodeEnable
How can I move the cursor, press Escape or Backspace when Hjklmode is enabled?
Vim key mappings:
| Key mapping | Equivalent to |
|---|---|
| Ctrl-[ | Escape (if you have an American English keyboard) |
| Ctrl-C | Similar to Escape (check :help i_CTRL-C) |
| Ctrl-h | Backspace |
| Ctrl-j | Enter |
| Ctrl-m | Enter |
| Ctrl-i | Tab |
| Ctrl-f | Page down |
| Ctrl-b | Page up |
| h | Left |
| j | Down |
| k | Up |
| l | Right |
| 0 (zero) | Home |
| $ | End |
For more information:
- :help motion.txt
- :help search-commands
License
Copyright (C) 2021-2026 James Cherti. Distributed under terms of the MIT license.
Related posts:
- Vim: Edit all the files in the current directory of a Git repository in new tabs (git ls-files)
- Vim: Enhance Vim tabs (file name only, file status, and the ability to rename tabs)
- Vim script: Replace the home directory with a tilde ~
- Configure XFCE 4 programmatically with the help of watch-xfce-xfconf
- A Vim plugin for persisting and restoring Vim editing sessions
- Vim theme: tomorrow-night-deepblue, a refreshing color scheme with a deep blue background
- pathaction.el: An Emacs package for executing pathaction rules, the universal Makefile for the entire filesystem
- Python: Read the shebang line of a script
- A Vim function that returns all monospaced fonts (UNIX / Linux only)
- Vim: Tango color scheme for Vim’s built-in Terminal
- Vim: Open documentation in a new tab for the word under the cursor (Vim help, Python, man pages, Markdown, Ansible…)
- How to make Vim edit/diff files from outside of Vim? (e.g. from a shell like Bash, Zsh, Fish..)
- Vim: Quickly replace the word that is under the cursor
- Set up Vim to use Fasd for quickly jumping to directories
- Lightvim – The Efficient Minimal Vim/Neovim Configuration
- A Vim plugin for executing pathaction, the universal Makefile for the entire filesystem
- Emacs Theme: Tomorrow Night Deepblue, a beautiful theme with a deep blue background
- pre-commit-elisp – Pre-commit hooks for Emacs Lisp (Elisp) Git repositories
- ansible-role-auto-upgrade – An Ansible role that automates upgrading Linux operating systems
- Gentoo Linux: Printer driver for the Brother QL-1110NWB