mirror of
https://github.com/mawww/kakoune.git
synced 2026-11-04 14:06:36 +01:00
Page:
Normal mode commands
Pages
Ambiguous Keys
Annotated examples of "Kakoune script"
Avoid the escape key
Bar
Bc
Building
Clang
Community
Ctags
Distinguish between focused and unfocused clients in Tmux
Documenting Plugins
Dynamic Window Title
EditorConfig
Eval Exec
Fuzzy finder
Git integration via Tig
Grep
HTML editing
Hacking
Header files
Highlighters
Home
IDE
Implementing user mode
Increment and Decrement
Indentation and Tabulation
Info boxes
Installing Plugins
Integrating Other CLI apps
JSON RPC
Jumplist
Kak daemon helper : 1 session per project
Languages
Line flags
Manipulating dates with Chronic
Migrating from Vim popular plugins
Migrating from Vim
Normal mode commands
OpenBSD
Plugin Managers
Qalculate
Ranger
Readline
Regex
Registers & Clipboard
Registers Clipboard
Reverse search
Running commands at startup
Rust
Selections combinations
Selections
Setting Plugin Options
Shell scripting
Status line
String syntax
TUI
The window scope
Tips for building from source
Undo tree
Wc
Windows tips
Wrapping
Writing Plugins
kak ‐p
macOS tips
zsh zle
No results
73
Normal mode commands
Elfogadodhe edited this page 2024-03-28 22:05:01 +01:00
Table of contents
A list of key and commands for normal mode. Meant to supplement the keymap and keys doc - especially for people using alternate keyboard layouts.
The following keys are free for you to customize: 0, D, X, Y, ', #, ^, -, =, and <ret>. See suggestions
Beware of ambiguous keys like <tab> vs <c-i> and <ret> vs <c-j> and <c-m>.
For a bigger table, see Kakoune explain keys
| Key | Description | ALT + key | CTRL + key | g key (goto) | |
|---|---|---|---|---|---|
| a | insert after selected text | select whole object | last buffer | ||
| A | insert at line end | ||||
| b | select to previous word start | select to previous WORD start | scroll one page up | window bottom | |
| B | extend to previous word start | extend to previous WORD start | |||
| c | change selected text | change selected text without yanking | window center | ||
| C | copy selection on next lines | copy selection on previous lines | |||
| d | erase selected text | erase selected text without yanking | scroll one half page down | ||
| D | |||||
| e | select to next word end | select to next WORD end | buffer end | ||
| E | extend to next word end | extend to next WORD end | |||
| f | select to next character included | select to previous character included | scroll one page down | file | |
| F | extend to next character included | extend to previous character included | |||
| g | go to location | ||||
| G | extend to location | ||||
| h | move left | select to line begin | undo last selection change | line begin | |
| H | extend left | extend to line begin | |||
| i | insert before selected text | select inner object | jump forward in jump list | line begin (non blank) | |
| I | insert at line begin | ||||
| j | move down | join lines | (ambiguous) | buffer bottom | |
| J | extend down | join lines and select spaces | |||
| k | move up | keep selections matching given regex | redo last selection change | buffer top | |
| K | extend up | keep selections not matching given regex | |||
| l | move right | select to line end | force screen redraw | line end | |
| L | extend right | extend to line end | |||
| m | select to next matching character | select to previous matching character | (ambiguous) | ||
| M | extend to next matching character | extend to previous matching character | |||
| n | select next current search pattern match | select previous current search pattern match | |||
| N | extend with next current search pattern match | extend with previous current search pattern match | |||
| o | insert on new line below | add a new empty line below | jump backward in jump list | ||
| O | insert on new line above | add a new empty line above | |||
| p | paste after selected text | paste every yanked selection after selected text | |||
| P | paste before selected text | paste every yanked selection before selected text | |||
| q | replay recorded macro | ||||
| Q | start or end macro recording | ||||
| r | replace with character | ||||
| R | replace selected text with paired yanked text | replace selected text with all yanked texts | |||
| s | select regex matches in selected text | split selected text on line ends | push current selections in jump list | ||
| S | split selected text on regex matches | select first and last characters of each selections | |||
| t | select to next character | select to previous character | window top | ||
| T | extend to next character | extend to previous character | |||
| u | undo | move backward in history | scroll one half page up | ||
| U | redo | move forward in history | |||
| v | manipulate view | ||||
| V | lock view mode | ||||
| w | select to next word start | select to next WORD start | |||
| W | extend to next word start | extend to next WORD start | |||
| x | expand selections to contain full lines (including end-of-lines) | trim selections to only contain full lines (not including last end-of-line) | |||
| X | |||||
| y | yank (copy) selected text | ||||
| Y | |||||
| z | restore selections | combine selections from register | |||
| Z | save selections | combine selections to register | |||
| external shell commands | |||||
| ! | insert command output | append command output | |||
| $ | pipe each selection through shell command and keep the ones whose command succeed | ||||
| | | pipe each selection through filter and replace with output | pipe each selection through command and ignore output | |||
| align / indent | |||||
| & | align cursors | copy indentation | |||
| @ | convert tabs to spaces | convert spaces to tabs | |||
| < | deindent | deindent, not including incomplete indent | |||
| > | indent | indent, including empty lines | |||
| selections | |||||
| % | select whole buffer | ||||
| ( | rotate main selection backward | rotate selections content backward | |||
| ) | rotate main selection forward | rotate selections content forward | |||
| ; semicolon | reduce selections to their cursor | swap cursors and anchors | |||
| _ | trim selections | merge contiguous selections together | |||
| search | |||||
| * | set search pattern to main selection content | set search pattern to main selection content, do not detect words | |||
| / | select next given regex match | select previous given regex match | |||
| ? | extend with next given regex match | extend with previous given regex match | |||
| text-objects | |||||
| [ | select to object start | select to inner object start | |||
| ] | select to object end | select to inner object end | |||
| { | extend to object start | extend to inner object start | |||
| } | extend to object end | extend to inner object end | |||
| text case | |||||
| ` | convert to lower case | swap case | |||
| ~ | convert to upper case | ||||
| , | clear selections to only keep the main one | clear the main selection | |||
| . | repeat last insert command | repeat last object or t/f selection command | last buffer change | ||
| \ | disable hooks | ||||
| : | enter command prompt | ensure cursor is after anchor | |||
| " | choose register | ||||
| ' | |||||
| # | |||||
| ^ | |||||
| - | |||||
| = | |||||
| + | duplicate each selection (generating overlapping selections) | merge overlapping selections | |||
| Up | move up | ||||
| Down | move down | ||||
| Left | move left | ||||
| Right | move right | ||||
| Home | select to line begin | ||||
| End | select to line end | ||||
| PageDown | scroll one page down | ||||
| PageUp | scroll one page up | ||||
| Space | enter default user mode to access custom commands | ||||
| Backspace | remove count | ||||
| Escape | |||||
| Return | |||||
| Tab | often interpreted as ctrl+i | ||||
Suggestions
alt + number offer 10 keys to customize. Example:
map global normal <a-3> ':echo free<ret>'
# vim old habits
map global normal D '<a-l>d' -docstring 'delete to end of line'
map global normal Y '<a-l>y' -docstring 'yank to end of line'
map global normal = :format<ret> -docstring 'format buffer'
map global normal '#' :comment-line<ret> -docstring 'comment line'
map global normal '<a-#>' :comment-block<ret> -docstring 'comment block'
map global goto m '<esc>m;' -docstring 'matching char'
# if you press 0 alone, it will echo "foo".
# if you press 0 after a number to express a count, like 10, it will work as usual.
map global normal 0 ':zero "echo foo"<ret>'
define-command zero -params 1 %{ evaluate-commands %sh{
if [ $kak_count = 0 ]; then
echo "$1"
else
echo "exec ${kak_count}0"
fi
}}
Wiki Home Page
Onboarding
Keys
- Normal mode commands
- Avoid the escape key
- Implementing user mode (Leader key)
- Kakoune explain
- Kakoune TV
Editing
User Interface
Integration with OS and other tools
- Languages
- IDE
- Bar
- Dynamic Window Title
- Kak daemon helper : 1 session per project
- Registers & Clipboard
- macOS tips
- Windows tips
- Fuzzy finders
- JSON-RPC UI
- bc
- Qalculate!
- wc
- Shell Scripting
- Manipulating dates with Chronic
- Integrating Other CLI apps
