kakoune/doc/pages/keys.asciidoc

676 lines
13 KiB
Plaintext
Raw Normal View History

= Keys
== Key Syntax
Usual keys are written using their ascii character, including capital
keys. Non printable keys use an alternate name, written between *<*
and *>*, such as *<esc>* or *<del>*. Modified keys are written between
*<* and *>* as well, with the modifier specified as either *c* for
Control, or *a* for Alt, followed by a *-* and the key (either its
name or ascii character), for example *<c-x>*, *<a-space>*.
In order to bind some keys to arbitrary ones, refer to the 'mapping'
documentation page.
== Insert mode
*<esc>*::
2017-11-02 10:37:39 +01:00
leave insert mode
*<backspace>*::
2017-11-02 10:37:39 +01:00
delete characters before cursors
*<del>*::
2017-11-02 10:37:39 +01:00
delete characters under cursors
*<left>*, *<right>*, *<up>*, *<down>*::
2017-11-02 10:37:39 +01:00
move the cursors in given direction
*<home>*::
2017-11-02 10:37:39 +01:00
move cursors to line begin
*<end>*::
2017-11-02 10:37:39 +01:00
move cursors to end of line
*<c-n>*::
2017-11-02 10:37:39 +01:00
select next completion candidate
*<c-p>*::
2017-11-02 10:37:39 +01:00
select previous completion candidate
*<c-x>*::
2017-11-02 10:37:39 +01:00
explicit insert completion query, followed by:
2017-11-02 10:37:39 +01:00
*f*:::
explicit file completion
2017-11-02 10:37:39 +01:00
*w*:::
explicit word completion (current buffer)
2017-11-02 10:37:39 +01:00
*W*:::
explicit word completion (all buffers)
2017-11-02 10:37:39 +01:00
*l*:::
explicit line completion
*<c-o>*::
2017-11-02 10:37:39 +01:00
disable automatic completion for this insert session
*<c-r>*::
2017-11-02 10:37:39 +01:00
insert contents of the register given by next key
*<c-v>*::
2017-11-02 10:37:39 +01:00
insert next keystroke directly into the buffer, without interpreting it
*<c-u>*::
2017-11-02 10:37:39 +01:00
commit changes up to now as a single undo group
*<a-;>*::
2017-11-02 10:37:39 +01:00
escape to normal mode for a single command
== Using Counts
In normal mode, commands can be prefixed with a numeric count, which can control
the command behaviour.
For example, *3W* selects 3 consecutive words and *3w* select the third word on
the right of selection end.
== Disabling Hooks
Any normal mode command can be prefixed with *\* which will disable hook execution
for the duration for the command (including the duration of modes the command could
move to, so *\i* will disable hooks for the whole insert session).
As autoindentation is implemented in terms of hooks, this can be used to disable
it when pasting text.
== Movement
2016-02-10 22:03:49 +01:00
'word' is a sequence of alphanumeric characters or underscore, and 'WORD'
is a sequence of non whitespace characters
*h*::
2017-11-02 10:37:39 +01:00
select the character on the left of selection end
*j*::
2017-11-02 10:37:39 +01:00
select the character below the selection end
*k*::
2017-11-02 10:37:39 +01:00
select the character above the selection end
*l*::
2017-11-02 10:37:39 +01:00
select the character on the right of selection end
*w*::
2017-11-02 10:37:39 +01:00
select the word and following whitespaces on the right of selection end
*b*::
2017-11-02 10:37:39 +01:00
select preceding whitespaces and the word on the left of selection end
*e*::
2017-11-02 10:37:39 +01:00
select preceding whitespaces and the word on the right of selection end
*<a-[wbe]>*::
2017-11-02 10:37:39 +01:00
same as [wbe] but select WORD instead of word
*f*::
2017-11-02 10:37:39 +01:00
select to the next occurrence of given character
*t*::
2017-11-02 10:37:39 +01:00
select until the next occurrence of given character
*<a-[ft]>*::
2017-11-02 10:37:39 +01:00
same as [ft] but in the other direction
*m*::
select to matching character, see the `matching_pairs` options
in <<doc/pages/options#,`:doc options`>>
*M*::
2017-11-02 10:37:39 +01:00
extend selection to matching character
*x*::
2017-11-02 10:37:39 +01:00
select line on which selection end lies (or next line when end lies
on an end-of-line)
2017-04-25 10:39:50 +02:00
*X*:: similar to *x*, except the current selection is extended
*<a-x>*::
2017-11-02 10:37:39 +01:00
expand selections to contain full lines (including end-of-lines)
*<a-X>*::
2017-11-02 10:37:39 +01:00
trim selections to only contain full lines (not including last
end-of-line)
*%*::
2017-11-02 10:37:39 +01:00
select whole buffer
*<a-h>*::
2017-11-02 10:37:39 +01:00
select to line begin
*<a-l>*::
2017-11-02 10:37:39 +01:00
select to line end
*/*::
2017-11-02 10:37:39 +01:00
search (select next match)
*<a-/>*::
2017-11-02 10:37:39 +01:00
search (select previous match)
*?*::
2017-11-02 10:37:39 +01:00
search (extend to next match)
*<a-?>*::
2017-11-02 10:37:39 +01:00
search (extend to previous match)
*n*::
2017-11-02 10:37:39 +01:00
select next match
*N*::
2017-11-02 10:37:39 +01:00
add a new selection with next match
*<a-n>*::
2017-11-02 10:37:39 +01:00
select previous match
*<a-N>*::
2017-11-02 10:37:39 +01:00
add a new selection with previous match
*pageup, <c-b>*::
2017-11-02 10:37:39 +01:00
scroll one page up
*pagedown, <c-f>*::
2017-11-02 10:37:39 +01:00
scroll one page down
*<c-u>*::
2017-11-02 10:37:39 +01:00
scroll half a page up
*<c-d>*::
2017-11-02 10:37:39 +01:00
scroll half a page down
*'*::
2017-11-02 10:37:39 +01:00
rotate selections (the main selection becomes the next one)
*<a-'>*::
2017-11-02 10:37:39 +01:00
rotate selections backwards
*;*::
2017-11-02 10:37:39 +01:00
reduce selections to their cursor
*<a-;>*::
2017-11-02 10:37:39 +01:00
flip the selections direction
*<a-:>*::
2017-11-02 10:37:39 +01:00
ensure selections are in forward direction (cursor after anchor)
*<a-.>*::
2017-11-02 10:37:39 +01:00
repeat last object or *f*/*t* selection command
== Changes
*i*::
2017-11-02 10:37:39 +01:00
enter insert mode before current selection
*a*::
2017-11-02 10:37:39 +01:00
enter insert mode after current selection
*d*::
2017-11-02 10:37:39 +01:00
yank and delete current selection
*c*::
2017-11-02 10:37:39 +01:00
yank and delete current selection and enter insert mode
*.*::
2017-11-02 10:37:39 +01:00
repeat last insert mode change (*i*, *a*, or *c*, including the
inserted text)
*<a-d>*::
2017-11-02 10:37:39 +01:00
delete current selection (not yanking)
*<a-c>*::
2017-11-02 10:37:39 +01:00
delete current selection and enter insert mode (not yanking)
*I*::
2017-11-02 10:37:39 +01:00
enter insert mode at current selection begin line start
*A*::
2017-11-02 10:37:39 +01:00
enter insert mode at current selection end line end
*o*::
2017-11-02 10:37:39 +01:00
enter insert mode in a new line (or in a given count of new lines) below
current selection end
*O*::
2017-11-02 10:37:39 +01:00
enter insert mode in a new line (or in a given count of new lines) above
current selection begin
*<a-o>*::
2017-11-02 10:37:39 +01:00
add an empty line below cursor
*<a-O>*::
2017-11-02 10:37:39 +01:00
add an empty line above cursor
*y*::
2017-11-02 10:37:39 +01:00
yank selections
*p*::
2017-11-02 10:37:39 +01:00
paste after current selection end
*P*::
2017-11-02 10:37:39 +01:00
paste before current selection begin
*<a-p>*::
2017-11-02 10:37:39 +01:00
paste all after current selection end, and select each pasted string
*<a-P>*::
2017-11-02 10:37:39 +01:00
paste all before current selection begin, and select each pasted string
*R*::
2017-11-02 10:37:39 +01:00
replace current selection with yanked text
*<a-R>*::
2017-11-02 10:37:39 +01:00
replace current selection with every yanked text
*r*::
2017-11-02 10:37:39 +01:00
replace each character with the next entered one
*<a-j>*::
2017-11-02 10:37:39 +01:00
join selected lines
*<a-J>*::
2017-11-02 10:37:39 +01:00
join selected lines and select spaces inserted in place of line breaks
*<a-m>*::
2017-11-02 10:37:39 +01:00
merge contiguous selections together (works across lines as well)
*>*::
2017-11-02 10:37:39 +01:00
indent selected lines
*<a\->>*::
2017-11-02 10:37:39 +01:00
indent selected lines, including empty lines
*<*::
2017-11-02 10:37:39 +01:00
deindent selected lines
*<a-<>*::
2017-11-02 10:37:39 +01:00
deindent selected lines, do not remove incomplete indent (3 leading
spaces when indent is 4)
2016-02-10 22:03:49 +01:00
*|*::
2017-11-02 10:37:39 +01:00
pipe each selection through the given external filter program and
replace the selection with its output
2016-02-10 22:03:49 +01:00
*<a-|>*::
2017-11-02 10:37:39 +01:00
pipe each selection through the given external filter program and
ignore its output
*!*::
2017-11-02 10:37:39 +01:00
insert command output before selection
*<a-!>*::
2017-11-02 10:37:39 +01:00
append command output after selection
*u*::
2017-11-02 10:37:39 +01:00
undo last change
*<a-u>*::
2017-11-02 10:37:39 +01:00
move backward in history
*U*::
2017-11-02 10:37:39 +01:00
redo last change
*<a-U>*::
2017-11-02 10:37:39 +01:00
move forward in history
*&*::
2017-11-02 10:37:39 +01:00
align selection, align the cursor of selections by inserting spaces
before the first character of the selection
*<a-&>*::
2017-11-02 10:37:39 +01:00
copy indent, copy the indentation of the main selection (or the
count one if a count is given) to all other ones
*`*::
2017-11-02 10:37:39 +01:00
to lower case
*~*::
2017-11-02 10:37:39 +01:00
to upper case
*<a-`>*::
2017-11-02 10:37:39 +01:00
swap case
*@*::
2017-11-02 10:37:39 +01:00
convert tabs to spaces in current selections, uses the buffer tabstop
option or the count parameter for tabstop
*<a-@>*::
2017-11-02 10:37:39 +01:00
convert spaces to tabs in current selections, uses the buffer tabstop
option or the count parameter for tabstop
*<a-">*::
2017-11-02 10:37:39 +01:00
rotate selections content, if specified, the count groups selections,
so the following command
----------
3<a-">
----------
2017-11-02 10:37:39 +01:00
rotate (1, 2, 3) and (3, 4, 6) independently
== Goto Commands
*g*, *G*::
2017-11-02 10:37:39 +01:00
When a count is specified, *G* only extends the current selection to the given line,
*g* sends the anchor to the given line and a menu is then displayed which waits
for one of the following additional keys:
2017-11-02 10:37:39 +01:00
*h*:::
go to line begin
2017-11-02 10:37:39 +01:00
*l*:::
go to line end
2017-11-02 10:37:39 +01:00
*i*:::
go to non blank line start
2017-11-02 10:37:39 +01:00
*g*, *k*:::
go to the first line
2017-11-02 10:37:39 +01:00
*j*:::
go to the last line
2017-11-02 10:37:39 +01:00
*e*:::
go to last char of last line
2017-11-02 10:37:39 +01:00
*t*:::
go to the first displayed line
2017-11-02 10:37:39 +01:00
*c*:::
go to the middle displayed line
2017-11-02 10:37:39 +01:00
*b*:::
go to the last displayed line
2017-11-02 10:37:39 +01:00
*a*:::
go to the previous (alternate) buffer
2017-11-02 10:37:39 +01:00
*f*:::
open the file whose name is selected
2017-11-02 10:37:39 +01:00
*.*:::
go to last buffer modification position
== View commands
*v*, *V*::
2017-11-02 10:37:39 +01:00
*V* enters lock view mode (which will be left when the <esc> is hit),
and *v* modifies the current view; a menu is then displayed which waits
for one of the following additional keys:
2017-11-02 10:37:39 +01:00
*v*, *c*:::
center the main selection in the window (vertically)
2017-11-02 10:37:39 +01:00
*m*:::
center the main selection in the window (horizontally)
2017-11-02 10:37:39 +01:00
*t*:::
scroll to put the main selection on the top line of the window
2017-11-02 10:37:39 +01:00
*b*:::
scroll to put the main selection on the bottom line of the window
2017-11-02 10:37:39 +01:00
*h*:::
scroll the window count columns left
2017-11-02 10:37:39 +01:00
*j*:::
scroll the window count line downward
2017-11-02 10:37:39 +01:00
*k*:::
scroll the window count line upward
2017-11-02 10:37:39 +01:00
*l*:::
scroll the window count columns right
== Marks
Marks use the *^* register by default.
*Z*::
2017-11-02 10:37:39 +01:00
save the current selections to the register
*z*::
2017-11-02 10:37:39 +01:00
restore the selections from the register
*<a-z>*, *<a-Z>*::
2017-11-02 10:37:39 +01:00
*<a-z>* combines the selections from the register with the current ones, whereas
*<a-Z>* combines the current selections with the register; a menu is then
displayed which waits for one of the following additional keys:
2017-11-02 10:37:39 +01:00
*a*:::
append the selections
2017-11-02 10:37:39 +01:00
*u*:::
keep a union of the selections
2017-11-02 10:37:39 +01:00
*i*:::
keep an intersection of the selections
2017-11-02 10:37:39 +01:00
*<*:::
select the selection with the leftmost cursor for each pair
2017-11-02 10:37:39 +01:00
*>*:::
select the selection with the rightmost cursor for each pair
2017-11-02 10:37:39 +01:00
*+*:::
select the longest selection
2017-11-02 10:37:39 +01:00
*-*:::
select the shortest selection
== Macros
Macros use the *@* register by default
*<esc>*::
2017-11-02 10:37:39 +01:00
end macro recording
*Q*::
2017-11-02 10:37:39 +01:00
start or end macro recording
*q*::
2017-11-02 10:37:39 +01:00
play a recorded macro
== Searching
Searches use the */* register by default
***::
2017-11-02 10:37:39 +01:00
set the search pattern to the current selection (automatically
detects word boundaries)
*<a-***>*::
2017-11-02 10:37:39 +01:00
set the search pattern to the current selection (verbatim, no smart
detection)
== Jump list
*<c-i>*::
2017-11-02 10:37:39 +01:00
Jump forward
*<c-o>*::
2017-11-02 10:37:39 +01:00
Jump backward
*<c-s>*::
2017-11-02 10:37:39 +01:00
save current selections
== Multiple selections
*s*::
2017-11-02 10:37:39 +01:00
create a selection
*<a-s>*::
2017-11-02 10:37:39 +01:00
split the current selections on line boundaries
*S*::
2017-11-02 10:37:39 +01:00
split the current selection
*C*::
2017-11-02 10:37:39 +01:00
copy the current selection to the next line
*<a-C>*::
2017-11-02 10:37:39 +01:00
copy the current selection to the previous line
*<space>*::
2017-11-02 10:37:39 +01:00
clear a multiple selection
*<a-space>*::
2017-11-02 10:37:39 +01:00
clear the current selection
*<a-k>*::
2017-11-02 10:37:39 +01:00
keep the selections that match the given regex
*<a-K>*::
2017-11-02 10:37:39 +01:00
clear selections that match the given regex
*$*::
2017-11-02 10:37:39 +01:00
pipe each selection to the given shell command and keep the ones
for which the shell returned 0
== Object Selection
*<a-a>*::
2017-11-02 10:37:39 +01:00
selects the whole object
*<a-i>*::
2017-11-02 10:37:39 +01:00
selects the inner object, that is the object excluding its surrounder
*[*::
2017-11-02 10:37:39 +01:00
selects to object start
*]*::
2017-11-02 10:37:39 +01:00
selects to object end
*{*::
2017-11-02 10:37:39 +01:00
extends selections to object start
*}*::
2017-11-02 10:37:39 +01:00
extends selections to object end
2016-02-10 22:03:49 +01:00
After these keys, you need to enter a second key in order to specify which
object you want
*b*, *(*, *)*::
2017-11-02 10:37:39 +01:00
select the enclosing parenthesis
*B*, *{*, *}*::
2017-11-02 10:37:39 +01:00
select the enclosing {} block
*r*, *[*, *]*::
2017-11-02 10:37:39 +01:00
select the enclosing [] block
*a*, *<*, *>*::
2017-11-02 10:37:39 +01:00
select the enclosing <> block
*"*, *Q*::
2017-11-02 10:37:39 +01:00
select the enclosing double quoted string
*'*, *q*::
2017-11-02 10:37:39 +01:00
select the enclosing single quoted string
*`*, *g*::
2017-11-02 10:37:39 +01:00
select the enclosing grave quoted string
*w*::
2017-11-02 10:37:39 +01:00
select the whole word
*W*::
2017-11-02 10:37:39 +01:00
select the whole WORD
*s*::
2017-11-02 10:37:39 +01:00
select the sentence
*p*::
2017-11-02 10:37:39 +01:00
select the paragraph
*␣*::
2017-11-02 10:37:39 +01:00
select the whitespaces
*i*::
2017-11-02 10:37:39 +01:00
select the current indentation block
*n*::
2017-11-02 10:37:39 +01:00
select the number
*u*::
2017-11-02 10:37:39 +01:00
select the argument
*c*::
2017-11-02 10:37:39 +01:00
select user defined object, will prompt for open and close text
== Prompt Commands
*<ret>*::
2017-11-02 10:37:39 +01:00
validate prompt
*<esc>*::
2017-11-02 10:37:39 +01:00
abandon without
*<left>*, *<a-h>*::
2017-11-02 10:37:39 +01:00
move cursor to previous character
*<right>*, *<a-l>*::
2017-11-02 10:37:39 +01:00
move cursor to previous character
*<home>*::
2017-11-02 10:37:39 +01:00
move cursor to first character
*<end>*::
2017-11-02 10:37:39 +01:00
move cursor past the last character
*<backspace>*, *<a-x>*::
2017-11-02 10:37:39 +01:00
erase character before cursor
*<del>*, *<a-d>*::
2017-11-02 10:37:39 +01:00
erase character under cursor
*<c-w>*::
2017-11-02 10:37:39 +01:00
avance to next word begin
*<c-a-w>*::
2017-11-02 10:37:39 +01:00
advance to next WORD begin
*<c-b>*::
2017-11-02 10:37:39 +01:00
go back to previous word begin
*<c-a-b>*::
2017-11-02 10:37:39 +01:00
go back to previous WORD begin
*<c-e>*::
2017-11-02 10:37:39 +01:00
advance to next word end
*<c-a-e>*::
2017-11-02 10:37:39 +01:00
advance to next word end
*<up>*, *<c-p>*::
2017-11-02 10:37:39 +01:00
select previous entry in history
*<down>*, *<c-n>*::
2017-11-02 10:37:39 +01:00
select next entry in history
*<tab>*::
2017-11-02 10:37:39 +01:00
select next completion candidate
*<backtab>*::
2017-11-02 10:37:39 +01:00
select previous completion candidate
*<c-r>*::
2017-11-02 10:37:39 +01:00
insert then content of the register given by next key
*<c-v>*::
2017-11-02 10:37:39 +01:00
insert next keystroke without interpreting it
*<c-o>*::
2017-11-02 10:37:39 +01:00
disable auto completion for this prompt