on 44566ea help sign in
helix/book/src/keymap.md
203 lines 11 kB history raw
1# Keymap
3## Normal mode
5### Movement
7> NOTE: `f`, `F`, `t` and `T` are not confined to the current line.
9| Key | Description |
10| ----- | ----------- |
11| `h`, `Left` | Move left |
12| `j`, `Down` | Move down |
13| `k`, `Up` | Move up |
14| `l`, `Right` | Move right |
15| `w` | Move next word start |
16| `b` | Move previous word start |
17| `e` | Move next word end |
18| `t` | Find 'till next char |
19| `f` | Find next char |
20| `T` | Find 'till previous char |
21| `F` | Find previous char |
22| `Home` | Move to the start of the line |
23| `End` | Move to the end of the line |
24| `PageUp` | Move page up |
25| `PageDown` | Move page down |
26| `Ctrl-u` | Move half page up |
27| `Ctrl-d` | Move half page down |
28| `Ctrl-i` | Jump forward on the jumplist TODO: conflicts tab |
29| `Ctrl-o` | Jump backward on the jumplist |
30| `v` | Enter [select (extend) mode](#select--extend-mode) |
31| `g` | Enter [goto mode](#goto-mode) |
32| `m` | Enter [match mode](#match-mode)
33| `:` | Enter command mode |
34| `z` | Enter [view mode](#view-mode) |
35| `Ctrl-w` | Enter [window mode](#window-mode) (maybe will be remove for spc w w later) |
36| `Space` | Enter [space mode](#space-mode) |
37| `K` | Show documentation for the item under the cursor |
39### Changes
41| Key | Description |
42| ----- | ----------- |
43| `r` | Replace with a character |
44| `R` | Replace with yanked text |
45| `i` | Insert before selection |
46| `a` | Insert after selection (append) |
47| `I` | Insert at the start of the line |
48| `A` | Insert at the end of the line |
49| `o` | Open new line below selection |
50| `o` | Open new line above selection |
51| `u` | Undo change |
52| `U` | Redo change |
53| `y` | Yank selection |
54| `p` | Paste after selection |
55| `P` | Paste before selection |
56| `>` | Indent selection |
57| `<` | Unindent selection |
58| `=` | Format selection |
59| `d` | Delete selection |
60| `c` | Change selection (delete and enter insert mode) |
62### Selection manipulation
64| Key | Description |
65| ----- | ----------- |
66| `s` | Select all regex matches inside selections |
67| `S` | Split selection into subselections on regex matches |
68| `Alt-s` | Split selection on newlines |
69| `;` | Collapse selection onto a single cursor |
70| `Alt-;` | Flip selection cursor and anchor |
71| `%` | Select entire file |
72| `x` | Select current line, if already selected, extend to next line |
73| | Expand selection to parent syntax node TODO: pick a key |
74| `J` | join lines inside selection |
75| `K` | keep selections matching the regex TODO: overlapped by hover help |
76| `Space` | keep only the primary selection TODO: overlapped by space mode |
77| `Ctrl-c` | Comment/uncomment the selections |
79### Search
81> TODO: The search implementation isn't ideal yet -- we don't support searching
82in reverse, or searching via smartcase.
84| Key | Description |
85| ----- | ----------- |
86| `/` | Search for regex pattern |
87| `n` | Select next search match |
88| `N` | Add next search match to selection |
89| `*` | Use current selection as the search pattern |
91### Diagnostics
93> NOTE: `[` and `]` will likely contain more pair mappings in the style of
94> [vim-unimpaired](https://github.com/tpope/vim-unimpaired)
96| Key | Description |
97| ----- | ----------- |
98| `[d` | Go to previous diagnostic |
99| `]d` | Go to next diagnostic |
100| `[D` | Go to first diagnostic in document |
101| `]D` | Go to last diagnostic in document |
103## Select / extend mode
105I'm still pondering whether to keep this mode or not. It changes movement
106commands to extend the existing selection instead of replacing it.
108> NOTE: It's a bit confusing at the moment because extend hasn't been
109> implemented for all movement commands yet.
111## View mode
113View mode is intended for scrolling and manipulating the view without changing
114the selection.
116| Key | Description |
117| ----- | ----------- |
118| `z` , `c` | Vertically center the line |
119| `t` | Align the line to the top of the screen |
120| `b` | Align the line to the bottom of the screen |
121| `m` | Align the line to the middle of the screen (horizontally) |
122| `j` | Scroll the view downwards |
123| `k` | Scroll the view upwards |
125## Goto mode
127Jumps to various locations.
129> NOTE: Some of these features are only available with the LSP present.
131| Key | Description |
132| ----- | ----------- |
133| `g` | Go to the start of the file |
134| `e` | Go to the end of the file |
135| `h` | Go to the start of the line |
136| `l` | Go to the end of the line |
137| `s` | Go to first non-whitespace character of the line |
138| `t` | Go to the top of the screen |
139| `m` | Go to the middle of the screen |
140| `b` | Go to the bottom of the screen |
141| `d` | Go to definition |
142| `y` | Go to type definition |
143| `r` | Go to references |
144| `i` | Go to implementation |
145| `a` | Go to the last accessed/alternate file |
147## Match mode
149Enter this mode using `m` from normal mode. See the relavant section
150in [Usage](./usage.md#surround) for an explanation about surround usage.
152| Key | Description |
153| ----- | ----------- |
154| `m` | Goto matching bracket |
155| `s` `<char>` | Surround current selection with `<char>` |
156| `r` `<from><to>` | Replace surround character `<from>` with `<to>` |
157| `d` `<char>` | Delete surround character `<char>` |
159## Object mode
161TODO: Mappings for selecting syntax nodes (a superset of `[`).
163## Window mode
165This layer is similar to vim keybindings as kakoune does not support window.
167| Key | Description |
168| ----- | ------------- |
169| `w`, `Ctrl-w` | Switch to next window |
170| `v`, `Ctrl-v` | Vertical right split |
171| `h`, `Ctrl-h` | Horizontal bottom split |
172| `q`, `Ctrl-q` | Close current window |
174## Space mode
176This layer is a kludge of mappings I had under leader key in neovim.
178| Key | Description |
179| ----- | ----------- |
180| `f` | Open file picker |
181| `b` | Open buffer picker |
182| `s` | Open symbol picker (current document) |
183| `w` | Enter [window mode](#window-mode) |
184| `space` | Keep primary selection TODO: it's here because space mode replaced it |
185| `p` | paste system clipboard after selections |
186| `P` | paste system clipboard before selections |
187| `y` | join and yank selections to clipboard |
188| `Y` | yank main selection to clipboard |
189| `R` | replace selections by clipboard contents |
191# Picker
193Keys to use within picker.
195| Key | Description |
196| ----- | ------------- |
197| `Up`, `Ctrl-p` | Previous entry |
198| `Down`, `Ctrl-n` | Next entry |
199| `Ctrl-space` | Filter options |
200| `Enter` | Open selected |
201| `Ctrl-h` | Open horizontally |
202| `Ctrl-v` | Open vertically |
203| `Escape`, `Ctrl-c` | Close picker |