From e12690e2f5c881db731bc8e7efe8554d5d423e78 Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Sat, 3 Sep 2022 14:22:17 -0400 Subject: [PATCH] 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. --- book/src/keymap.md | 34 +++++++++++++++++--------------- helix-term/src/keymap/default.rs | 19 ------------------ 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 698b504c7..da4433f3d 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -315,10 +315,12 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire ## Insert Mode -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 | | ----- | ----------- | ------- | @@ -327,23 +329,23 @@ undo-able "save point" until you return to normal mode. | `Ctrl-r` | Insert a register content | `insert_register` | | `Ctrl-w`, `Alt-Backspace`, `Ctrl-Backspace` | Delete previous word | `delete_word_backward` | | `Alt-d`, `Alt-Delete`, `Ctrl-Delete` | Delete next word | `delete_word_forward` | -| `Alt-b`, `Ctrl-Left` | Backward a word | `move_prev_word_end` | -| `Ctrl-b`, `Left` | Backward a char | `move_char_left` | -| `Alt-f`, `Ctrl-Right` | Forward a word | `move_next_word_start` | -| `Ctrl-f`, `Right` | Forward a char | `move_char_right` | -| `Ctrl-e`, `End` | Move to line end | `goto_line_end_newline` | -| `Ctrl-a`, `Home` | Move to line start | `goto_line_start` | | `Ctrl-u` | Delete to start of line | `kill_to_line_start` | | `Ctrl-k` | Delete to end of line | `kill_to_line_end` | | `Ctrl-j`, `Enter` | Insert new line | `insert_newline` | | `Backspace`, `Ctrl-h` | Delete previous char | `delete_char_backward` | | `Delete`, `Ctrl-d` | Delete next char | `delete_char_forward` | -| `Ctrl-p`, `Up` | Move to previous line | `move_line_up` | -| `Ctrl-n`, `Down` | Move to next line | `move_line_down` | -| `PageUp` | Move one page up | `page_up` | -| `PageDown` | Move one page down | `page_down` | -| `Alt->` | Go to end of buffer | `goto_file_end` | -| `Alt-<` | Go to start of buffer | `goto_file_start` | + +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" +``` ## Select / extend mode diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index fd7ea457f..f07d4028c 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -355,25 +355,6 @@ pub fn default() -> HashMap { "A-del" => delete_word_forward, "C-s" => commit_undo_checkpoint, - "left" => move_char_left, - "C-b" => move_char_left, - "down" => move_line_down, - "up" => move_line_up, - "right" => move_char_right, - "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, - "C-k" => kill_to_line_end, "C-u" => kill_to_line_start,