Most Useful Kakoune Editor Commands
Work more effectively with the Vim-like Kakoune Editor
--
I have written about the Kakoune editor earlier, so I am not going to give much of an intro here. Kakoune is basically a significantly more user-friendly version of Vim. So if you like the concept of Vim, but find it hard to remember all the keys then Kakoune may be a better alternative.
Since last usage I have developed some slightly more effective ways of using the editor.
Moving Left and Right a Character or a Line
Instead of using left and right arrow keys for moving left and right, it may be good to get used to using h
and l
because these can be used in many related combinations.
h
andl
moves one character left or right.gh
andgl
moves to beginning or end of line.alt-h
andalt-l
selects text up to beginning or end of line.
What is the logic with the g
being used as prefix? g
stands for goto and brings up a navigation menu.
Code Block Selection
Code is made up of nested blocks defined by curly braces, parenthesis, quotes and other characters. To work effectively with code we need to be able to quickly select a block of code. These commands help do that.
m
placed on top of(
,{
and[
braces it will jump to the corresponding one and select everything in-between.[
or]
triggers menu, which lets you select which scope you want to select. E.g. you can select nearest[
,(
,"
,'
or{
. However downside compared tom
is that it goes from cursor to only one of them.
Opening and Editing Files
Files are opened with the :e
command. Files that are actually open are referred to as buffers and all they commands begin with :b
.
Make it Easier to See What you Are Editing
Use the v
key to get a menu of how to center your display. The most common choice is probably vv
which centers text around current cursor location.
Clever use of Selection
In Kakoune you can nest selections. Basically you select stuff with s
, using matches. However it requires a selection first. So you often start by selecting everything with %
. Then using s
you select a subset of everything. After you hit enter however you can use s
on the new selection you got. Hence you can easily keep going and narrowing down your selection.
Further Interest
This I think is one of the best guides I’ve come across to Kakoune, which really shows how you combine commands in clever ways.
Read more: My Kakoune Editor Configuration.