on c400a60 help sign in
helix/book/src/keymap.md
213 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| `W` | Move next WORD start |
19| `B` | Move previous WORD start |
20| `E` | Move next WORD end |
21| `t` | Find 'till next char |
22| `f` | Find next char |
23| `T` | Find 'till previous char |
24| `F` | Find previous char |
25| `Home` | Move to the start of the line |
26| `End` | Move to the end of the line |
27| `PageUp` | Move page up |
28| `PageDown` | Move page down |
29| `Ctrl-u` | Move half page up |
30| `Ctrl-d` | Move half page down |
31| `Ctrl-i` | Jump forward on the jumplist TODO: conflicts tab |
32| `Ctrl-o` | Jump backward on the jumplist |
33| `v` | Enter [select (extend) mode](#select--extend-mode) |
34| `g` | Enter [goto mode](#goto-mode) |
35| `m` | Enter [match mode](#match-mode) |
36| `:` | Enter command mode |
37| `z` | Enter [view mode](#view-mode) |
38| `Ctrl-w` | Enter [window mode](#window-mode) (maybe will be remove for spc w w later) |
39| `Space` | Enter [space mode](#space-mode) |
40| `K` | Show documentation for the item under the cursor |
42### Changes
44| Key | Description |
45| ----- | ----------- |
46| `r` | Replace with a character |
47| `R` | Replace with yanked text |
48| `~` | Switch case of the selected text |
49| `\`` | Set the selected text to upper case |
50| `Alt-\`` | Set the selected text to lower case |
51| `i` | Insert before selection |
52| `a` | Insert after selection (append) |
53| `I` | Insert at the start of the line |
54| `A` | Insert at the end of the line |
55| `o` | Open new line below selection |
56| `o` | Open new line above selection |
57| `u` | Undo change |
58| `U` | Redo change |
59| `y` | Yank selection |
60| `p` | Paste after selection |
61| `P` | Paste before selection |
62| `>` | Indent selection |
63| `<` | Unindent selection |
64| `=` | Format selection |
65| `d` | Delete selection |
66| `c` | Change selection (delete and enter insert mode) |
68### Selection manipulation
70| Key | Description |
71| ----- | ----------- |
72| `s` | Select all regex matches inside selections |
73| `S` | Split selection into subselections on regex matches |
74| `Alt-s` | Split selection on newlines |
75| `;` | Collapse selection onto a single cursor |
76| `Alt-;` | Flip selection cursor and anchor |
77| `%` | Select entire file |
78| `x` | Select current line, if already selected, extend to next line |
79| `X` | Extend selection to line bounds (line-wise selection) |
80| | Expand selection to parent syntax node TODO: pick a key |
81| `J` | join lines inside selection |
82| `K` | keep selections matching the regex TODO: overlapped by hover help |
83| `Space` | keep only the primary selection TODO: overlapped by space mode |
84| `Ctrl-c` | Comment/uncomment the selections |
86### Search
88> TODO: The search implementation isn't ideal yet -- we don't support searching
89in reverse, or searching via smartcase.
91| Key | Description |
92| ----- | ----------- |
93| `/` | Search for regex pattern |
94| `n` | Select next search match |
95| `N` | Add next search match to selection |
96| `*` | Use current selection as the search pattern |
98### Diagnostics
100> NOTE: `[` and `]` will likely contain more pair mappings in the style of
101> [vim-unimpaired](https://github.com/tpope/vim-unimpaired)
103| Key | Description |
104| ----- | ----------- |
105| `[d` | Go to previous diagnostic |
106| `]d` | Go to next diagnostic |
107| `[D` | Go to first diagnostic in document |
108| `]D` | Go to last diagnostic in document |
110## Select / extend mode
112I'm still pondering whether to keep this mode or not. It changes movement
113commands to extend the existing selection instead of replacing it.
115> NOTE: It's a bit confusing at the moment because extend hasn't been
116> implemented for all movement commands yet.
118## View mode
120View mode is intended for scrolling and manipulating the view without changing
121the selection.
123| Key | Description |
124| ----- | ----------- |
125| `z` , `c` | Vertically center the line |
126| `t` | Align the line to the top of the screen |
127| `b` | Align the line to the bottom of the screen |
128| `m` | Align the line to the middle of the screen (horizontally) |
129| `j` | Scroll the view downwards |
130| `k` | Scroll the view upwards |
132## Goto mode
134Jumps to various locations.
136> NOTE: Some of these features are only available with the LSP present.
138| Key | Description |
139| ----- | ----------- |
140| `g` | Go to the start of the file |
141| `e` | Go to the end of the file |
142| `h` | Go to the start of the line |
143| `l` | Go to the end of the line |
144| `s` | Go to first non-whitespace character of the line |
145| `t` | Go to the top of the screen |
146| `m` | Go to the middle of the screen |
147| `b` | Go to the bottom of the screen |
148| `d` | Go to definition |
149| `y` | Go to type definition |
150| `r` | Go to references |
151| `i` | Go to implementation |
152| `a` | Go to the last accessed/alternate file |
154## Match mode
156Enter this mode using `m` from normal mode. See the relavant section
157in [Usage](./usage.md) for an explanation about [surround](./usage.md#surround)
158and [textobject](./usage.md#textobject) usage.
160| Key | Description |
161| ----- | ----------- |
162| `m` | Goto matching bracket |
163| `s` `<char>` | Surround current selection with `<char>` |
164| `r` `<from><to>` | Replace surround character `<from>` with `<to>` |
165| `d` `<char>` | Delete surround character `<char>` |
166| `a` `<object>` | Select around textobject |
167| `i` `<object>` | Select inside textobject |
169## Object mode
171TODO: Mappings for selecting syntax nodes (a superset of `[`).
173## Window mode
175This layer is similar to vim keybindings as kakoune does not support window.
177| Key | Description |
178| ----- | ------------- |
179| `w`, `Ctrl-w` | Switch to next window |
180| `v`, `Ctrl-v` | Vertical right split |
181| `h`, `Ctrl-h` | Horizontal bottom split |
182| `q`, `Ctrl-q` | Close current window |
184## Space mode
186This layer is a kludge of mappings I had under leader key in neovim.
188| Key | Description |
189| ----- | ----------- |
190| `f` | Open file picker |
191| `b` | Open buffer picker |
192| `s` | Open symbol picker (current document) |
193| `w` | Enter [window mode](#window-mode) |
194| `space` | Keep primary selection TODO: it's here because space mode replaced it |
195| `p` | paste system clipboard after selections |
196| `P` | paste system clipboard before selections |
197| `y` | join and yank selections to clipboard |
198| `Y` | yank main selection to clipboard |
199| `R` | replace selections by clipboard contents |
201# Picker
203Keys to use within picker.
205| Key | Description |
206| ----- | ------------- |
207| `Up`, `Ctrl-p` | Previous entry |
208| `Down`, `Ctrl-n` | Next entry |
209| `Ctrl-space` | Filter options |
210| `Enter` | Open selected |
211| `Ctrl-h` | Open horizontally |
212| `Ctrl-v` | Open vertically |
213| `Escape`, `Ctrl-c` | Close picker |