From ← ↓ ↑ → to h j k l08 May 2015
One of the first things I learned in Linux was (at the time, unusable) terminal navigation shortcuts. CTRL + P to the previous command, CTRL + N to the next command, CTRL + F to forward one character and CTRL + B to backward one character. Why should I use this if I got a set of arrows just next to my hand?
Then I started to use Vim, just knowing how to open files, get in the insert mode, edit something and quit.
Vim file.txt and
ESC:wq was my only friends, but it was just too slow to move from the insert mode, to normal mode, use the arrows, back to insert mode. Then one little modificationa and all again, insert mode, normal mode, arrows, insert mode. My productivity was low, and I was thinking to switch to another editor, when I watched these videos:
Learning Vim in a Week
Write code faster: Expert-level Vim
And read these books (the second I’m actually reading):
A Byte of Vim – by Swaroop C H.
Practical Vim: Edit Text at the Speed of Thought – By Drew Nell and Tim Pope.
h j k l was the clue to everything. It just make sense, right? You never need to leave your hands out of the keyboard’s home run, you just do everything from there. It’s simple:
- h = ←
- j = ↓
- k = ↑
- l = →
Now you can enter in normal mode (ESC or CTRL + [ or some mapping) and start navigating around the file without the arrows. It makes the use of other shortcuts much faster. Need to open a new line? O. Need to start editing at beginning of the line? I. The shortcuts and customizations from Vim are so overwhelming that you don’t even need to leave the editor for a lot of tasks, like compiling code and modifying multiple files.
But this is just Vim, right? How is this useful somewhere else? Well…
Bash has a builtin navigation based on h j k l. You can make anything, from going back and forth, deleting, swaping chars etc. In the SS64 you can learn all the shortctus.
I’m using Terminator as my default Linux terminal. The multiple windows (not tabs) got my heart. It also allows you to customize the key bindings, so I setup some shortcuts to navigate between windows with ALT + (h j k l). Awesome!
Even to read PDF you don’t need a mouse or leave the home run. Just ALT + TAB to Atril (default PDF reader for Linux Mint) and navigate with h j k l.
How about Twitter? Scrolling down and up tweets with j and k are amazing! You can even do more, just type ? and see the shortcuts.
When I thought the mouse was almost useless, I find the Vimium plugin for Google Chrome. I can’t explain in words how awesome it is. You can use the same Vim shortcuts do change tabs, search in history/bookmark, open new links and use the F key to access any link in the page! You just press F and any link will get a little ballon with one or two characters and if you hit them, it will simulate the mouse click! It means navigating like a true h j k l devoted.
I’m sure there’s a lot of cool softwares out there that supports h j k l, and you should add this feature to yours, it just make life much easier! If you know some cool one, leave it at the comments!
h j k l FTW!