The Vi text editor has been around for a long time, has many fans and users, and ships with almost all available POSIX systems. To its credit, Vi hasn’t changed much, although it has managed to experience some major improvements (in fact, most Vi users actually use Vi-improved or Vim).
However, one of the best things about open source is how it can be adapted and iterated, so you might wonder what Vi would look like if it had been invented today. You can take a look at an alternate timeline with Kakoune, a modern editor similar to Vi that incorporates ideas from current editors as well as Vi and Vim.
Install Kakoune In
Fedora, you can install Kakoune from its repository:
$ sudo dnf kakoune
In Red Hat Enterprise Linux (RHEL), CentOS 7, and CentOS Stream, Kakoune is available in the EPEL project
. Using Kakoune Like Vi,
opens in a terminal window. The command to start it is kak, and you can start it with or without specifying a file to open.
This command opens the sample file.txt in Kakoune
or creates the file if it does not already exist
: example of $ kak.txt
Kakoune has two modes: normal mode and insert mode. Its default state is normal mode, and it’s how you interact with Kakoune as an app, as if you’re using a mouse to interact with GUI apps. In Kakoune, all interaction happens with the keyboard, whether you’re moving the cursor up or down a line, removing a character (or a word or line), copying and pasting, and anything else you can do in a text editor other than enter text.
To enter insert mode, press i. In insert mode, write and edit text as you would in any other editor. Unlike Vi, Kakoune favors the modern keyboard, so keys like Home and End and all arrow keys are considered standard keys for common actions like moving at the beginning or end of a line. There is not much to learn about insertion mode. It inserts text, and it can also be in Gedit or Notepadqq.
Kakoune always has some text actively selected, even when it is only one character wide (in which case your cursor is also your selection). Certain navigation tasks, such as jumping to the beginning or end of a word, involve greater selection.
By combining common navigation with selection, Kakoune is usually one step ahead of you. Consider this: when you jump forward a word, you may simply be jumping forward a word, in which case a selection is not important. However, sometimes when you jump forward a word, it’s because you need to select that word in order to copy or delete it. In those cases, Kakoune saves you the trouble of selecting an object because the navigation method has already done so.
Kakoune calls the two edges of a section the cursor and the anchor.
[ Keep common tasks in mind with this handy Linux command cheat sheet. ]
Kakoune clip wizard presents an anthropomorphic clip as an editing assistant. When you issue commands in Kakoune, your clip wizard appears and tells you all the possible completions for the command you typed.
If you’ve had any previous negative experiences with clip assistants, don’t worry. Kakune’s clip is actually very useful and dynamic. It’s a pop-up alert that disappears once your command is unique or complete enough.
Unlike insert mode, normal mode has many keyboard shortcuts and commands to learn. You can learn them all or just the essentials. They’re specifically designed to allow you to do more with fewer keystrokes, so don’t be surprised if you cut a few microseconds off the time it usually takes you to adjust a configuration file with Kakoune.
- ESC modes
- mode I (which is an uppercase i): insert
- after the cursor A: add text
- to the end of the current line Normal mode navigation can occur in the home row of your keyboard QWERTY:
: normal mode i: insert
text at the beginning of the current line A: add text
h or left arrow
- j trivially looks like a down arrow) k or up arrow: up cursor l (
- which is a lowercase L) or right arrow: right cursor b: cursor at the beginning of the current word, anchor at the end e: cursor at the end of the current word,
- , anchor to the beginning 7g: go to line 7 of the file
: left cursor j or down arrow: down cursor (
at the beginning
: go to the beginning of a line End: go to the end of a line gg: go to the first line of the file Gk: cursor to the first line of the file, anchor at the end
Ge: cursor to the last line of the file
Copy and paste and:
- copy (“throw”) selection
- p: paste
- x: select line
- u: undo
:w: save :
- wq or :ZZ
- q!: force quit without Save
: save and exit :
Kakoune Test Kakoune
is an interesting and progressive version of a classic text editor. It’s different from Vim, particularly in the way it treats navigation essentially the same as selection and in many of its keyboard shortcuts. However, if you are a fan of Vim and looking for something new to try, you should consider Kakoune.