Image
Try Kakoune for a modern Vi
Kakoune is a modern text editor that incorporates ideas from recent editors as well as Vi and Vim.
The Vi text editor has been around for a long time, it has lots of fans and users, and it ships with nearly every POSIX system available. To its credit, Vi hasn't changed all that much, although it has managed to undergo some major improvements (in fact, most Vi users actually use Vi-improved, or Vim).
One of the greatest things about open source is how it can be adapted and iterated upon, however, and so you might wonder what Vi might look like if it had been invented today. You can get a glimpse of such an alternate timeline with Kakoune, a modern Vi-like editor incorporating ideas from current editors as well as Vi and Vim.
Install Kakoune
On Fedora, you can install Kakoune from your repository:
$ sudo dnf kakoune
On Red Hat Enterprise Linux (RHEL), CentOS 7, and CentOS Stream, Kakoune is available from the EPEL project.
Using Kakoune
Like Vi, Kakoune opens in a terminal window. The command to launch it is kak
, and you can start it with or without specifying a file to open.
This command opens the file example.txt
in Kakoune or creates the file if it doesn't already exist:
$ kak example.txt
Modal editing
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 application, like you would use a mouse to interact with GUI applications. In Kakoune, all interaction happens with the keyboard, whether you're moving the cursor up or down a line, deleting a character (or a word or line), copying and pasting, and anything else you might do in a text editor aside from entering text.
To enter insert mode, press i. In insert mode, you type and edit text much as you would in any other editor. Unlike Vi, Kakoune favors the modern keyboard, so keys like Home and End and all the arrow keys are considered standard keys for common actions such as moving to the beginning or end of a line. There's not much to learn about insert mode. You insert text, and you may as well be in Gedit or Notepadqq.
Selecting text
Kakoune always has some text actively selected, even when it's just 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, imply a greater selection.
By combining common navigation with selection, Kakoune is often one step ahead of you. Consider this: When you jump forward a word, you might just be jumping forward a word, in which case a selection is unimportant. However, sometimes when you jump forward a word, it's because you need to select that word so that you can copy or remove 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 top of mind with this handy Linux commands cheat sheet. ]
Paperclip assistant
Kakoune features an anthropomorphic paperclip as your editing assistant. When you issue commands in Kakoune, your paperclip assistant appears and tells you all of the potential completions for the command you've typed.
If you've had any previous negative experiences with paperclip assistants, don't worry. Kakoune's paperclip is actually very useful and dynamic. It's a pop-up alert that disappears once your command is sufficiently unique or complete.
Keyboard shortcuts
Unlike insert mode, normal mode has many keyboard shortcuts and commands to learn. You can learn them all or just the essentials. They're designed specifically to enable you to do more with fewer key presses, so don't be surprised if you shave a few microseconds off the time it usually takes you to adjust a config file with Kakoune.
Modes
- ESC: normal mode
- i: insert mode
- I (that's a capital i): insert text at beginning of the current line
- a: append text after the cursor
- A: append text at end of the current line
Navigation
Navigation in normal mode can happen on the home row of your QWERTY keyboard:
- h or Left arrow: cursor left
- j or Down arrow: cursor down (j looks trivially like a down arrow)
- k or Up arrow: cursor up
- l (that's a lower-case L) or Right arrow: cursor right
- b: cursor to the beginning of the current word, anchor at the end
- e: cursor to end of the current word, anchor at the beginning
- Home: 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, anchor at the beginning
- 7g: go to line 7 of the file
Copy and paste
- y: copy ("yank") selection
- p: paste
Selection
- w: select word
- x: select line
Undo
- u: undo
Save
- :w: save
- :wq or :ZZ: save and quit
- :q!: force quit without saving
Try Kakoune
Kakoune is an interesting and progressive take on a classic text editor. It's different from Vim, particularly in how it treats navigation essentially the same as selection and in many of its keyboard shortcuts. However, if you're a fan of Vim looking for something new to try, you should consider Kakoune.
Image
Once you've committed Vi's keyboard shortcuts to muscle memory, watch how fast you work.
Image
Ed is one of the oldest, smallest, and most powerful text editors available.
Image
Make discovering your favorite new text editor the highlight of your year!
Topics:
Text editors
Software
Seth Kenlon
Seth Kenlon is a UNIX geek and free software enthusiast. More about me