Linux 3 min read

Kakoune: The Vim Alternative Built on Multiple Selections

Suresh Suresh
Kakoune: The Vim Alternative Built on Multiple Selections

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.

  1. Immediate Visual Feedback: Because you select text before acting on it, you never accidentally delete the wrong variable or jump to the wrong paragraph.
  2. 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.
  3. 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) then w (word).
  • In Kakoune: Press w (select word). The word highlights on your screen. You visually confirm it. Then, press d (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 press c (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.

  1. Highlight the first instance using w.
  2. Press % to select the entire buffer.
  3. Press s (Select by regex). Type old_variable and press Enter.
  4. Kakoune will instantly place a cursor on every single instance of old_variable in your file.
  5. Press c to change them, and type new_variable.

It is basically a global Find-and-Replace, but it happens live, on your screen, with full visual feedback.

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!

  • l moves your cursor one character to the right.
  • L extends 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!

Suresh

Written by Suresh

A passionate technology enthusiast, blogger, and self-taught developer. I write about Linux, Open Source, Cloud Computing, and emerging technologies to help students and beginners learn tech for free.

Discussion

Loading comments...