System-Wide Navigation with h, j, k, l (Inspired by Vim)
This script, written in AutoHotkey v2, maps the h
, j
, k
, and l
keys to the arrow keys throughout your entire system. It allows you to navigate like in Vim, helping you build muscle memory without moving your hands from the home row. Press the CapsLock
key to toggle between normal typing and navigation modes.
- The Caps Lock key is used to toggle "navigation mode" on or off.
- When navigation mode is active:
- The Caps Lock LED on your keyboard serves as a visual indicator.
- A tooltip will briefly show "Navigation Mode ON" or "Navigation Mode OFF" for user feedback.
- h, j, k, and l are remapped to function like arrow keys:
h
-> Left Arrowj
-> Down Arrowk
-> Up Arrowl
-> Right Arrow
- Holding Shift while using these keys allows text selection.
- Modifier key combinations are supported for extended functionality:
- Ctrl + h/j/k/l for larger movements or text selection.
- Alt + h/j/k/l for actions like Alt + Arrow keys.
- Win + h/j/k/l for actions like snapping windows (if supported by the OS).
- When navigation mode is off, the
h
,j
,k
, andl
keys work normally. - Modifier keys (Shift, Ctrl, Alt, or Win) work as expected for typing or other commands.
- Vim-Inspired Navigation:
Theh
,j
,k
, andl
keys mimic Vim's movement keys, allowing efficient navigation without reaching for the arrow keys. - CapsLock for Mode Switching:
TheCapsLock
key serves as a convenient toggle for switching between typing and navigation modes without disrupting your workflow.
- Go to the AutoHotkey website and download the installer.
- Follow the prompts to install AutoHotkey on your system.
- Copy the script into a text editor (like Notepad).
- Save it with a
.ahk
extension (e.g.,navigation_mode.ahk
).
- Double-click on the
.ahk
file you just created. - The script will run immediately, and you should see an AutoHotkey icon in your system tray.
- Press CapsLock to toggle between normal mode and navigation mode.
- In navigation mode, use the keys:
h
= Left,j
= Down,k
= Up,l
= Right.
- Hold Shift with these keys to select text.
- Optionally, use Ctrl, Alt, or Win with these keys for additional navigation functionality.
Disable the arrow keys on your keyboard to encourage using h
, j
, k
, and l
for all navigation tasks. This helps you develop Vim-like muscle memory for faster and more efficient navigation.
To stop the script, right-click the AutoHotkey icon in the system tray and select Exit.