[idea] Allow copy-mode keymaps to be configured. #587
Replies: 1 comment 1 reply
|
+1 to this proposal. I thought about a possible spec, so I would like to share it here. Why I want thisIn my case, I want to use emacs-style keybindings in copy mode, the same bindings I use in my other tools. Everyone prefers different keys, so if each action can be configured, this would cover a wide range of use cases. Proposed specherdr already has a good precedent for this. In #193, the keys inside navigate mode became configurable as flat For copy mode, I think Esc is the only key that needs to stay reserved. Esc switches between two functions depending on context — it clears the selection or search if there is one, and exits otherwise — so it does not fit the one-action-per-field form. Keeping it out of the config also guarantees that you can always leave copy mode with Esc, no matter what settings are written. Every key other than Esc can be overridden or unbound as a default key in the table below. For example, in my case, I could get emacs-style keys like this: [keys]
copy_mode = "prefix+[" # existing field (the key to enter copy mode), unchanged
copy_mode_cursor_down = "ctrl+n"
copy_mode_cursor_up = "ctrl+p"
copy_mode_begin_selection = "ctrl+space"
copy_mode_copy = ["ctrl+w", "y"]
...For reference, tmux has a two-layer design: vi/emacs presets plus per-key overrides. But for herdr, I think the simple form following the navigate precedent — keep the defaults and override per action — is enough. People who want emacs-style bindings can write all the actions, and this form also stays compatible if presets are added later. Also, if we want to make it clearer that these are keybindings for a mode, a sub-table like Proposed field namesThe names are based on tmux copy-mode command names, vim terms, existing herdr fields (
|
Uh oh!
There was an error while loading. Please reload this page.
idea / problem
Herdr lets users configure the keybinding that enters copy mode with
keys.copy_mode, but the keybindings used inside copy mode are currently fixed.For example, copy mode uses
h/j/k/lfor movement,w/b/efor word motions,{/}for paragraph movement,vor Space to start selection,yor Enter to copy, andqor Esc to exit.This works well as a vi-style default, but it is hard to adapt for users who want different copy-mode bindings.
requested change
Allow copy-mode keymaps to be configured while preserving the current bindings as defaults.
why you want this
The default vi-style copy mode is a good starting point, but some keys are awkward depending on keyboard layout. For me,
{and}are uncomfortable enough that I avoid using those motions.Since Herdr already supports configurable keybindings elsewhere, I expected copy-mode actions to be configurable too. Keeping the current defaults while allowing remaps would make copy mode easier to use without changing behavior for existing users.
All reactions