LinuxCommandLibrary

kak

Edit text files interactively

TLDR

Open a file and enter normal mode, to execute commands

$ kak [path/to/file]
copy

Enter insert mode from normal mode, to write text into the file
$ <i>
copy

Escape insert mode, to go back to normal mode
$ <Esc>
copy

Replace all instances of "foo" in the current file with "bar"
$ %s[foo]<Enter>c[bar]<Esc>
copy

Unselect all secondary selections, and keep only the main one
$ <Space>
copy

Search for numbers and select the first two
$ /\d+<Enter>N
copy

Insert the contents of a file
$ <!>cat [path/to/file]<Enter>
copy

Save the current file
$ <:>w<Enter>
copy

SYNOPSIS

kak [options] [files] ...

PARAMETERS

-c commands
    Execute commands on startup after loading configuration

-d
    Diff mode: read files from stdin and display differences

-f regex
    List sessions whose name matches regex

-l
    List existing sessions

-n
    Do not source configuration files; read-only session

-p pid
    Send keys to client with given process ID

-s session
    Connect to given session

-S
    Present a list of existing sessions to select from

-u rcfile
    Use specified configuration file instead of default

-v
    Print version information

-h
    Display help

DESCRIPTION

Kakoune is a fast, modal text editor designed with a selection-first paradigm, where selections are made before actions are applied. Unlike Vim's action-then-motion model, Kakoune inverts this: you select text first, then apply commands to all selections simultaneously. This enables powerful multiple-selection editing, high performance via zero-copy selections, and a composable interface.

Key features include client-server architecture for multiple views of the same session, syntax highlighting via regex or tree-sitter, integrated LSP support, and a tiling interface. It's highly extensible with a powerful scripting language called Kakscript. Kakoune emphasizes discoverability with intuitive key bindings and on-screen documentation.

Ideal for programmers seeking efficiency beyond traditional editors, it runs on Unix-like systems and supports large files efficiently. The editor shines in editing structured text like code, where multi-cursor operations reduce keystrokes dramatically.

CAVEATS

Steep learning curve due to inverted selection model; requires unlearning Vim habits. Client-server model can confuse beginners. No native Windows support.

INVOCATION EXAMPLES

kak file.txt: open file
kak -s mysession: attach to session
kak -c 'edit file.txt': execute command

PARADIGM SHIFT

Use %s/old/new/g to substitute on all selections; motions like w (word), /regex extend selections efficiently.

HISTORY

Developed by Maxime Coste (mawww) starting in 2013 as a modern Vim alternative. First release in 2015; version 1.0 in 2022. Focuses on performance and multiple selections. Actively maintained with tree-sitter integration in recent versions.

SEE ALSO

vim(1), nvim(1), helix(1), micro(1)

Copied to clipboard