Linux (Updated: ) 9 min read

Kakoune Editor: The Selection-First Modal Revolution in 2026

Suresh S Suresh S
Kakoune Editor: The Selection-First Modal Revolution in 2026

Vim’s editing grammar is practically a religion among infrastructure engineers and programmers. It operates on a strict verb-noun system that allows you to “speak” to your text editor. To delete a word, you press dw (Delete Word). The action verb (d) is issued first, followed by the object noun (w).

While this “Action → Object” philosophy is undeniably fast when managing Linux VPS servers, it suffers from one glaring, anxiety-inducing flaw: you do not know exactly what you are going to delete until after you have deleted it. If you press di( hoping to delete everything inside a nested JSON block for a Docker Compose stack, you rely entirely on blind faith that you calculated the scope correctly. If you were wrong, you mash u to undo and try again.

Enter Kakoune, the terminal-based text editor created by Maxime Coste. It boldly takes Vim’s sacred grammar and flips it upside down.

In Kakoune, the philosophy is Selection → Action. You highlight your target text first, visually confirm the scope is accurate, and then you execute the deletion or modification. This paradigm shift fundamentally alters how you write code, especially when coupled with Kakoune’s true superpower: first-class, natively integrated multiple cursors.

In this deep-dive guide, we will explore Kakoune’s Unix-friendly architecture, its heavy reliance on POSIX shell scripting, and why it is rapidly becoming a favorite tool among modern DevOps engineers.

1. The Core Paradigm: Selection-Driven Editing

To master Kakoune, you must consciously unlearn the Vim habit of blind execution. In Kakoune, every single movement is a selection. Even when you are just moving a solitary cursor around the screen using your arrow keys, you are technically dragging a “one-character selection” across the buffer.

Let’s examine the mechanical difference for a routine sysadmin task: modifying a variable inside an Ansible playbook.

Task: Delete the current word.

  • In Vim / Neovim: You press d (Delete) and then w (Word). The word instantly vanishes.
  • In Kakoune: You press w (Select Word). The word is instantly highlighted in bright colors on your screen. You visually confirm it is the correct word. Then, you press d (Delete).

Task: Change the text inside a set of quotes.

  • In Vim: You press c (Change), i (Inside), " (Quotes). The text disappears and you enter Insert mode.
  • In Kakoune: You press M (Select Around), i (Inside), " (Quotes). The text inside the quotes is highlighted. You visually verify the scope. You press c (Change) to enter Insert mode.

By shifting to the “Selection First” model, Kakoune eradicates the anxiety of guessing how far an operation will reach. It provides a visual safety net for every single edit, preventing disastrous mistakes when configuring critical systemd service files or UFW firewall rules.

(Note: If you love the selection-first model but want an editor written in Rust with built-in Language Server capabilities, you should also read our guide to the Helix modal editor, which was heavily inspired by Kakoune).

2. Navigating Like a Pro: Extending Selections

Because every movement is a selection, navigation feels simultaneously familiar and entirely alien.

Kakoune retains the beloved hjkl keys, ensuring your hands never leave the home row when operating over an SSH connection:

  • h: Move left.
  • j: Move down.
  • k: Move up.
  • l: Move right.

However, since moving the cursor is just moving a 1-character selection, how do you highlight a larger block of text? You simply hold down the Shift key to extend the selection.

  • L (Shift + L): Extends the selection one character to the right.
  • J (Shift + J): Extends the selection one line down.
  • W (Shift + W): Extends the selection to the end of the next word.

Advanced Text Objects

Kakoune provides highly granular shortcuts for grabbing complex programming objects—crucial when parsing massive Linux system logs.

  • x: Selects the entire current line. (Pressing it multiple times selects multiple lines downward).
  • <Alt-i> (Inner Object): Followed by a character like p (paragraph) or w (word), this highlights the inner contents of that block.
  • <Alt-a> (Around Object): Similar to Inner, but grabs the surrounding whitespace or boundary brackets.
  • %: Selects the entire buffer (document). Essential for global substitutions.

3. The Multi-Cursor Revolution

While the selection-first model is brilliant, Kakoune’s true claim to fame is its handling of multiple cursors.

In Vim, multiple cursors are often hacked in via brittle third-party plugins that frequently conflict with native macros. In Kakoune, multiple selections are the foundational engine of the entire binary. Every command you issue applies to every active selection simultaneously.

The Regex Selection Workflow

Imagine you are refactoring a massive Python script for a Node.js backend deployment. You need to change the variable temp_data_array to processed_items, but only within a specific 50-line function block.

Here is the Kakoune workflow:

  1. Move your cursor to the top of the function.
  2. Press J repeatedly to drag your selection down to the bottom of the function block.
  3. Press s (Select by Regex). A prompt appears at the bottom of the screen.
  4. Type temp_data_array and hit Enter.
  5. Kakoune scans only within your highlighted block and spawns a distinct, blinking cursor on every single instance of that variable.
  6. Press c (Change). All instances disappear.
  7. Type processed_items. You will watch the text update simultaneously across the entire function.
  8. Press <Escape> to collapse back to a single primary cursor.

This workflow is infinitely more intuitive than attempting to construct a flawless :%s/find/replace/g substitution command, especially when modifying delicate configurations like Traefik or Nginx reverse proxies.

4. The Client-Server Architecture

One of the most radical engineering choices made by Maxime Coste was how Kakoune handles window management.

Vim includes a massive internal window manager allowing you to split your screen (:vsplit) and manage tabs. Kakoune explicitly rejects this approach in favor of the strict Unix Philosophy: “Do one thing and do it well.”

Kakoune argues that window management is the responsibility of your Terminal Multiplexer (like tmux or zellij) or your graphical Window Manager (like i3 or sway).

How It Works

When you launch Kakoune, you are actually launching a headless background server and connecting a lightweight client to it.

If you want to view a file side-by-side:

  1. Open a new pane in tmux.
  2. Run the command kak -c [session_name].
  3. The new terminal pane connects to the exact same background editing session as your first pane.

Because both terminal panes are piped into the same server, they share identical buffers, clipboard registers, and undo histories. If you highlight a word in Window A, you will see it highlight in real-time in Window B. This client-server architecture makes collaborative editing trivial and prevents the Kakoune C++ codebase from becoming bloated with complex UI rendering logic.

5. Scripting and Extensibility: Embracing POSIX

Extensibility has always been a severe pain point for modal editors. Vim relies on Vimscript (which is notoriously archaic) or Lua. Emacs requires a PhD in Lisp.

Kakoune takes a completely different path: it integrates directly with standard POSIX shell scripting.

If you want to write a plugin or a complex macro in Kakoune, you write standard Bash or Zsh scripts that pipe text in and out of the editor using standard Linux utilities like awk, sed, and grep.

The %sh{} Expansion

Kakoune allows you to execute shell commands inline and insert the standard output directly into your buffer.

For example, if you want to insert the current system date into your document, you don’t write a custom Kakoune plugin. You simply type: !date<Enter> This pipes your current active selection into the standard Unix date command and replaces the text with the output.

This means if you already know how to write a bash script to manage a Proxmox home lab, you already know how to write a Kakoune plugin.

6. Installation and Configuration

Because Kakoune relies on a modern C++ compiler, it is highly portable and easily installed via standard Linux package managers.

Installation

Debian / Ubuntu / Pop!_OS:

sudo apt update
sudo apt install kakoune

Fedora / RHEL:

sudo dnf install kakoune

Arch Linux:

sudo pacman -S kakoune

macOS (Homebrew):

brew install kakoune

Configuration (kakrc)

Your personalized configuration is stored in ~/.config/kak/kakrc. Here is a basic example that sets up line numbers, tab widths, and theme colors:

# ~/.config/kak/kakrc

# Enable line numbers on the left margin
add-highlighter global/ number-lines -relative

# Set tab width to 4 spaces
set-option global tabstop 4
set-option global indentwidth 4

# Map 'jj' to Escape to quickly exit insert mode
map global insert j '<esc>'
map global insert J 'j'

Extending with Plugins

While Kakoune is powerful out of the box, the community utilizes a lightweight plugin manager called plug.kak. You can easily add extensions for Language Server Protocol (LSP) intelligence (kak-lsp) to provide real-time syntax checking for Python or Rust, or integrate fzf for lightning-fast file searching.

Official Documentation

Frequently Asked Questions (FAQ)

What makes Kakoune different from Vim or Neovim?

Kakoune flips Vim’s “Action then Object” grammar into a “Selection then Action” model. Instead of deleting a word blindly (dw), you select the word first (w) to visually confirm the scope, and then apply the delete action (d). This provides critical visual feedback before executing destructive edits.

How does Kakoune handle multiple cursors?

Unlike Vim, where multiple cursors are often hacked in via unstable plugins, Kakoune is built from the ground up around multiple selections as a foundational mechanic. You can use regex or line-splitting shortcuts to spawn cursors on multiple variables simultaneously, making global refactoring incredibly precise.

Does Kakoune have a built-in window manager like Vim’s :vsplit?

No. Kakoune explicitly rejects internal window management in favor of the Unix Philosophy. It operates on a robust client-server architecture, encouraging users to rely on dedicated terminal multiplexers (like tmux or zellij) or graphical window managers (like i3 or sway) to handle screen splitting.

How do you write plugins or extensions for Kakoune?

Instead of forcing users to learn a proprietary scripting language like Vimscript or Lua, Kakoune integrates directly with standard POSIX shells. You can write plugins and complex macros using Bash scripts to pipe text into standard Unix tools like awk, sed, grep, or curl.

Is Kakoune available on macOS as well as Linux?

Yes, Kakoune is highly portable. It can be easily installed on macOS via Homebrew (brew install kakoune), or on Linux via standard package managers like APT for Ubuntu (sudo apt install kakoune) or Pacman for Arch Linux.

Does Kakoune support Language Server Protocol (LSP)?

Yes. While it doesn’t ship natively with LSP like Helix does, Kakoune supports LSP through a widely used, highly stable community plugin called kak-lsp, which provides auto-completion, diagnostics, and code navigation for languages like Rust, Python, and Go.

Can I run Kakoune over a slow SSH connection?

Absolutely. Because Kakoune is a terminal-based editor written in highly optimized C++, it renders extremely fast over SSH connections, making it an excellent choice for editing configuration files on remote headless servers or VPS instances.

How do I exit Kakoune?

If you are in Insert mode, press the <Escape> key to return to Normal mode. Then, type :q and press Enter to quit. If you have unsaved changes and want to force quit without saving, type :q!. To save and quit, type :wq. (This is identical to Vim).

What does the %sh{} block do in Kakoune?

The %sh{} block allows you to execute arbitrary shell commands directly from within the editor’s command prompt or configuration file, and pipe the output directly back into the Kakoune buffer. It bridges the editor directly to the underlying operating system.

Is Kakoune difficult to learn if I already know Vim?

There is a learning curve. Because the navigation keys (hjkl) are identical, your muscle memory will initially betray you when you try to execute commands. However, most users report that the “Selection First” paradigm clicks within a few days of consistent use, after which returning to Vim’s blind execution feels archaic.

Suresh S

Written by Suresh S

Systems Engineer & Tech Educator with 8+ years of experience in Linux Administration, Cloud Computing, and Cybersecurity. Founder of FreeTechLearner, dedicated to creating practical tutorials that help students and professionals build real-world skills.

Share this post:

Discussion

Loading comments...