Skip to content

Commit

Permalink
Add back changes from helix-editor#3827
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Walrus committed Sep 14, 2022
1 parent 88ef01c commit 12f7360
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 8 deletions.
38 changes: 34 additions & 4 deletions book/src/generated/static-cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,12 @@ looking over text and not actively editing it).
| `n` | Select next search match | `search_next` |
| `N` | Select previous search match | `search_prev` |
## Insert
We support many readline/emacs style bindings in insert mode for convenience.
These can be helpful for making simple modifications without escaping to normal
mode, but beware that you will not have an undo-able "save point" until you
return to normal mode.
Insert mode bindings are somewhat minimal by default. Helix is designed to
be a modal editor, and this is reflected in the user experience and internal
mechanics. For example, changes to the text are only saved for undos when
escaping from insert mode to normal mode. For this reason, new users are
strongly encouraged to learn the modal editing paradigm to get the smoothest
experience.

| Key | Description | Command |
| --- | --- | --- |
Expand All @@ -291,6 +293,34 @@ return to normal mode.
| `C-u` | Delete till start of line | `kill_to_line_start` |
| `C-x` | Invoke completion popup | `completion` |
| `C-r` | Insert register | `insert_register` |

However, if you really want navigation in insert mode, this is supported. An
example config that gives the ability to use arrow keys while still in insert
mode:

```toml
[keys.insert]
"up" = "move_line_up"
"down" = "move_line_down"
"left" = "move_char_left"
"right" = "move_char_right"
"C-b" = "move_char_left"
"C-f" = "move_char_right"
"A-b" = "move_prev_word_end"
"C-left" = "move_prev_word_end"
"A-f" = "move_next_word_start"
"C-right" = "move_next_word_start"
"A-<" = "goto_file_start"
"A->" = "goto_file_end"
"pageup" = "page_up"
"pagedown" = "page_down"
"home" = "goto_line_start"
"C-a" = "goto_line_start"
"end" = "goto_line_end_newline"
"C-e" = "goto_line_end_newline"
"A-left" = "goto_line_start"
```

## Select
This mode echoes Normal mode, but changes any movements to extend
selections rather than replace them. Goto motions are also changed to
Expand Down
42 changes: 38 additions & 4 deletions book/src/modes/insert.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,38 @@
We support many readline/emacs style bindings in insert mode for convenience.
These can be helpful for making simple modifications without escaping to normal
mode, but beware that you will not have an undo-able "save point" until you
return to normal mode.
Insert mode bindings are somewhat minimal by default. Helix is designed to
be a modal editor, and this is reflected in the user experience and internal
mechanics. For example, changes to the text are only saved for undos when
escaping from insert mode to normal mode. For this reason, new users are
strongly encouraged to learn the modal editing paradigm to get the smoothest
experience.






However, if you really want navigation in insert mode, this is supported. An
example config that gives the ability to use arrow keys while still in insert
mode:

```toml
[keys.insert]
"up" = "move_line_up"
"down" = "move_line_down"
"left" = "move_char_left"
"right" = "move_char_right"
"C-b" = "move_char_left"
"C-f" = "move_char_right"
"A-b" = "move_prev_word_end"
"C-left" = "move_prev_word_end"
"A-f" = "move_next_word_start"
"C-right" = "move_next_word_start"
"A-<" = "goto_file_start"
"A->" = "goto_file_end"
"pageup" = "page_up"
"pagedown" = "page_down"
"home" = "goto_line_start"
"C-a" = "goto_line_start"
"end" = "goto_line_end_newline"
"C-e" = "goto_line_end_newline"
"A-left" = "goto_line_start"
```

0 comments on commit 12f7360

Please sign in to comment.