-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable keys 2 (Mapping keys to commands) #268
Changes from all commits
0ac3ad7
d1cbc82
c01981c
104b422
815cfd6
d99b606
d7e0f66
cbb3b0f
8460780
da47069
f336d09
2cd3a7c
0fdbd11
feda589
818978b
26211d0
e86cc8f
d47c7ba
9e57822
4c6fa7c
5a096e4
41792a2
3211056
dd1daed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Null? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not exactly sure what this is, I'm just transcribing the underlying Crossterm |
||
* Escape => "esc" | ||
|
||
Commands can be found in the source code at `../../helix-term/src/commands.rs` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Back tab?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are valid key codes, originating back to early IBM computers ¯_(ツ)_/¯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about focus in and focus out available in kakoune?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh... I didn't even know focus in/out was information you could get inside a terminal. Relevant link:
https://unix.stackexchange.com/a/480138
That would be pretty cool to be able to bind to commands. Then you could auto-save all files on focus-out, for example.
(Although, long-term a proper auto-save feature will be better for that, of course.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem like Crossterm offers primitives for that, but it does sound interesting! Probably outside of the scope of this PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I don't think it's widely supported or anything, just interesting trivia about old features :)