on master help sign in
Remove default insert mode movement bindings

Helix is first and foremost a modal editor. Willingness to support non-modal editing is there, but it is not one that should be encouraged with the default settings. There are an increasing number of users who are stumbling because they are trying to use Helix as a non-modal editor, so this is an effort to encourage new users to stop and take notice that Helix has a different paradigm than VSCode, Sublime, etc. Users can still add these bindings back to their own configs if they wish.

commite12690e2f5c881db731bc8e7efe8554d5d423e78 authorSkyler Hawthorne <skyler@dead10ck.com> dateSat 3 Sep 2022, 14:22 (4 years ago) parent5ab8528
2 files changed+18−35
book/src/keymap.md+18−16 helix-term/src/keymap/default.rs−19
book/src/keymap.md+18−16
@@ -315,10 +315,12 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire
315315
316316## Insert Mode
317317
318−We support many readline/emacs style bindings in insert mode for
319−convenience. These can be helpful for making simple modifications
320−without escaping to normal mode, but beware that you will not have an
321−undo-able "save point" until you return to normal mode.
318+Insert mode bindings are somewhat minimal by default. Helix is designed to
319+be a modal editor, and this is reflected in the user experience and internal
320+mechanics. For example, changes to the text are only saved for undos when
321+escaping from insert mode to normal mode. For this reason, new users are
322+strongly encouraged to learn the modal editing paradigm to get the smoothest
323+experience.
322324
323325| Key | Description | Command |
324326| ----- | ----------- | ------- |
@@ -327,23 +329,23 @@ undo-able "save point" until you return to normal mode.
327329| `Ctrl-r` | Insert a register content | `insert_register` |
328330| `Ctrl-w`, `Alt-Backspace`, `Ctrl-Backspace` | Delete previous word | `delete_word_backward` |
329331| `Alt-d`, `Alt-Delete`, `Ctrl-Delete` | Delete next word | `delete_word_forward` |
330−| `Alt-b`, `Ctrl-Left` | Backward a word | `move_prev_word_end` |
331−| `Ctrl-b`, `Left` | Backward a char | `move_char_left` |
332−| `Alt-f`, `Ctrl-Right` | Forward a word | `move_next_word_start` |
333−| `Ctrl-f`, `Right` | Forward a char | `move_char_right` |
334−| `Ctrl-e`, `End` | Move to line end | `goto_line_end_newline` |
335−| `Ctrl-a`, `Home` | Move to line start | `goto_line_start` |
336332| `Ctrl-u` | Delete to start of line | `kill_to_line_start` |
337333| `Ctrl-k` | Delete to end of line | `kill_to_line_end` |
338334| `Ctrl-j`, `Enter` | Insert new line | `insert_newline` |
339335| `Backspace`, `Ctrl-h` | Delete previous char | `delete_char_backward` |
340336| `Delete`, `Ctrl-d` | Delete next char | `delete_char_forward` |
341−| `Ctrl-p`, `Up` | Move to previous line | `move_line_up` |
342−| `Ctrl-n`, `Down` | Move to next line | `move_line_down` |
343−| `PageUp` | Move one page up | `page_up` |
344−| `PageDown` | Move one page down | `page_down` |
345−| `Alt->` | Go to end of buffer | `goto_file_end` |
346−| `Alt-<` | Go to start of buffer | `goto_file_start` |
337+
338+However, if you really want navigation in insert mode, this is supported. An
339+example config that gives the ability to use arrow keys while still in insert
340+mode:
341+
342+```toml
343+[keys.insert]
344+up = "move_line_up"
345+down = "move_line_down"
346+left = "move_char_left"
347+right = "move_char_right"
348+```
347349
348350## Select / extend mode
349351
helix-term/src/keymap/default.rs−19
@@ -355,25 +355,6 @@ pub fn default() -> HashMap<Mode, Keymap> {
355355 "A-del" => delete_word_forward,
356356 "C-s" => commit_undo_checkpoint,
357357
358− "left" => move_char_left,
359− "C-b" => move_char_left,
360− "down" => move_line_down,
361− "up" => move_line_up,
362− "right" => move_char_right,
363− "C-f" => move_char_right,
364− "A-b" => move_prev_word_end,
365− "C-left" => move_prev_word_end,
366− "A-f" => move_next_word_start,
367− "C-right" => move_next_word_start,
368− "A-<" => goto_file_start,
369− "A->" => goto_file_end,
370− "pageup" => page_up,
371− "pagedown" => page_down,
372− "home" => goto_line_start,
373− "C-a" => goto_line_start,
374− "end" => goto_line_end_newline,
375− "C-e" => goto_line_end_newline,
376−
377358 "C-k" => kill_to_line_end,
378359 "C-u" => kill_to_line_start,
379360