From f7e00cf720f55ea82933ac6625b7511e9d38139e Mon Sep 17 00:00:00 2001 From: PabloMansanet Date: Thu, 17 Jun 2021 13:08:05 +0200 Subject: Configurable keys 2 (Mapping keys to commands) (#268) * Add convenience/clarity wrapper for Range initialization * Add keycode parse and display methods * Add remapping functions and tests * Implement key remapping * Add remapping book entry * Use raw string literal for toml * Add command constants * Make command functions private * Map directly to commands * Match key parsing/displaying to Kakoune * Formatting pass * Update documentation * Formatting * Fix example in the book * Refactor into single config file * Formatting * Refactor configuration and add keymap newtype wrappers * Address first batch of PR comments * Replace FromStr with custom deserialize--- book/src/remapping.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 book/src/remapping.md (limited to 'book/src/remapping.md') diff --git a/book/src/remapping.md b/book/src/remapping.md new file mode 100644 index 00000000..313ac72e --- /dev/null +++ b/book/src/remapping.md @@ -0,0 +1,48 @@ +# Key Remapping + +One-way key remapping is temporarily supported via a simple TOML configuration +file. (More powerful solutions such as rebinding via commands will be +available in the feature). + +To remap keys, write a `config.toml` file in your `helix` configuration +directory (default `~/.config/helix` in Linux systems) with a structure like +this: + +```toml +# At most one section each of 'keys.normal', 'keys.insert' and 'keys.select' +[keys.normal] +a = "move_char_left" # Maps the 'a' key to the move_char_left command +w = "move_line_up" # Maps the 'w' key move_line_up +C-S-esc = "select_line" # Maps Control-Shift-Escape to select_line + +[keys.insert] +A-x = "normal_mode" # Maps Alt-X to enter normal mode +``` + +Control, Shift and Alt modifiers are encoded respectively with the prefixes +`C-`, `S-` and `A-`. Special keys are encoded as follows: + +* Backspace => "backspace" +* Space => "space" +* Return/Enter => "ret" +* < => "lt" +* > => "gt" +* + => "plus" +* - => "minus" +* ; => "semicolon" +* % => "percent" +* Left => "left" +* Right => "right" +* Up => "up" +* Home => "home" +* End => "end" +* Page Up => "pageup" +* Page Down => "pagedown" +* Tab => "tab" +* Back Tab => "backtab" +* Delete => "del" +* Insert => "ins" +* Null => "null" +* Escape => "esc" + +Commands can be found in the source code at `../../helix-term/src/commands.rs` -- cgit v1.2.3-70-g09d2 From f65db9397a2d832f7ef873ea416f13f8fb07cb74 Mon Sep 17 00:00:00 2001 From: Perry Thompson Date: Thu, 17 Jun 2021 15:55:39 -0500 Subject: Fix typos in Markdown documentation --- book/src/remapping.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'book/src/remapping.md') diff --git a/book/src/remapping.md b/book/src/remapping.md index 313ac72e..610d5179 100644 --- a/book/src/remapping.md +++ b/book/src/remapping.md @@ -26,9 +26,9 @@ Control, Shift and Alt modifiers are encoded respectively with the prefixes * Space => "space" * Return/Enter => "ret" * < => "lt" -* > => "gt" -* + => "plus" -* - => "minus" +* \> => "gt" +* \+ => "plus" +* \- => "minus" * ; => "semicolon" * % => "percent" * Left => "left" -- cgit v1.2.3-70-g09d2