Vim’s grammar is legendary. To delete a word, you type dw (Delete Word). The action (d) comes first, followed by the object (w). This “Action → Object” philosophy is incredibly fast, but it has one major flaw: you don’t know exactly what you are going to delete until after you have deleted it.
Enter Kakoune, the text editor that flips Vim’s grammar completely upside down.
In Kakoune, the philosophy is Selection → Action. You select your text first, visually confirm that the selection is correct, and then you act upon it. This subtle shift fundamentally changes how you interact with code, especially when combined with Kakoune’s true superpower: first-class multiple selections.
Why Choose Kakoune?
If you already know Vim, Kakoune will feel both incredibly familiar and wildly different.
- Immediate Visual Feedback: Because you select text before acting on it, you never accidentally delete the wrong variable or jump to the wrong paragraph.
- Multiple Selections as a Core Feature: Unlike Vim, where multiple cursors feel like an afterthought added via plugins, Kakoune was built from the ground up around multiple selections.
- Client-Server Architecture: Kakoune allows you to open multiple terminal windows that all connect to the exact same editing session in real-time.
Installation
Installing Kakoune (often simply called kak in the terminal) is straightforward on most distributions:
Ubuntu/Debian:
sudo apt update
sudo apt install kakoune
Fedora:
sudo dnf install kakoune
macOS:
brew install kakoune
Launch the editor by typing kak filename.txt.
The Paradigm Shift: Selection First
Let’s look at the difference between Vim and Kakoune for a simple edit:
Task: Delete the current word.
- In Vim: Press
d(delete) thenw(word). - In Kakoune: Press
w(select word). The word highlights on your screen. You visually confirm it. Then, pressd(delete).
Task: Change text inside quotes.
- In Vim: Press
c(change),i(inside),"(quotes). - In Kakoune: Press
M(select around),i(inside),"(quotes). The text inside the quotes is highlighted. Then pressc(change).
By shifting to the “Selection First” model, you remove the anxiety of guessing how far an operation will reach.
Mastering Multiple Selections
Multiple cursors are what make Kakoune an absolute joy to use. Imagine you want to change the word old_variable to new_variable everywhere in your file.
- Highlight the first instance using
w. - Press
%to select the entire buffer. - Press
s(Select by regex). Typeold_variableand press Enter. - Kakoune will instantly place a cursor on every single instance of
old_variablein your file. - Press
cto change them, and typenew_variable.
It is basically a global Find-and-Replace, but it happens live, on your screen, with full visual feedback.
Navigating Like a Pro
Kakoune retains Vim’s beloved hjkl navigation keys for moving Left, Down, Up, and Right. However, because everything is a selection, moving your cursor is actually moving a “1-character selection”.
To extend your selection instead of just moving the cursor, simply hold Shift!
lmoves your cursor one character to the right.Lextends your selection one character to the right.
Conclusion
Kakoune is an incredibly refreshing take on modal editing. By prioritizing visual feedback and treating multiple cursors as a core mechanic rather than a gimmick, it solves many of the pain points that traditional Vim users face.
If you love keeping your hands on the home row but want to see exactly what you are doing before you do it, give Kakoune a try!
Discussion
Loading comments...