Skip to content
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

Add commands for everything that's currently hardcoded. #9571

Closed
7ombie opened this issue Feb 8, 2024 · 4 comments
Closed

Add commands for everything that's currently hardcoded. #9571

7ombie opened this issue Feb 8, 2024 · 4 comments

Comments

@7ombie
Copy link
Contributor

7ombie commented Feb 8, 2024

There're a bunch of items in the Keymap doc that have N/A as their documented command. As a result, users can only customize a subset of their bindings.

For example, there's currently no way to assign a new keybinding for debugging. We must use g inside Space Mode. As my debugger is usually LLDB, I'd prefer to use l (inside Space Mode), but there's no debug command to bind to.

@the-mikedavis
Copy link
Member

Those N/As are there because the key opens a "minor mode" (another set of keybindings). Also see https://docs.helix-editor.com/keymap.html#minor-modes which is a set of bindings that do the same thing. The N/A for repeat last insert on that page is covered by #1488

@the-mikedavis the-mikedavis closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2024
@7ombie
Copy link
Contributor Author

7ombie commented Feb 8, 2024

Why does Helix treat minor mode bindings any differently? For example, if the user added this to their config...

[keys.normal.space]
l = "debug"
g = "no_op"

... couldn't the Space Mode be updated to remove g and add l etc?

It's not the end of the world, but it keeps coming up (I can't rebind the dot or colon, and have limits with minor modes). I just wondered if there was a reason to not support it (or if it just hadn't been implemented).

@the-mikedavis
Copy link
Member

Minor modes are really just groups of keybinds. For example <space>g and <space>w are defined as:

"g" => { "Debug (experimental)" sticky=true
"l" => dap_launch,
"r" => dap_restart,
"b" => dap_toggle_breakpoint,
"c" => dap_continue,
"h" => dap_pause,
"i" => dap_step_in,
"o" => dap_step_out,
"n" => dap_next,
"v" => dap_variables,
"t" => dap_terminate,
"C-c" => dap_edit_condition,
"C-l" => dap_edit_log,
"s" => { "Switch"
"t" => dap_switch_thread,
"f" => dap_switch_stack_frame,
// sl, sb
},
"e" => dap_enable_exceptions,
"E" => dap_disable_exceptions,
},
"w" => { "Window"
"C-w" | "w" => rotate_view,
"C-s" | "s" => hsplit,
"C-v" | "v" => vsplit,
"C-t" | "t" => transpose_view,
"f" => goto_file_hsplit,
"F" => goto_file_vsplit,
"C-q" | "q" => wclose,
"C-o" | "o" => wonly,
"C-h" | "h" | "left" => jump_view_left,
"C-j" | "j" | "down" => jump_view_down,
"C-k" | "k" | "up" => jump_view_up,
"C-l" | "l" | "right" => jump_view_right,
"H" => swap_view_left,
"J" => swap_view_down,
"K" => swap_view_up,
"L" => swap_view_right,
"n" => { "New split scratch buffer"
"C-s" | "s" => hsplit_new,
"C-v" | "v" => vsplit_new,
},
},

If you want to remap entire modes you need to move the commands in that mode:

[keys.normal.space]
g = "no_op"
[keys.normal.space.l]
l = "dap_launch"
r = "dap_restart"
# ... etc ...

I've reopened #5734 which talks about finding a convenient way to remap those.

I can't rebind the dot or colon

Colon isn't special-cased as far as I'm aware. You can rebind the command_mode command to another key and remap :.

@7ombie
Copy link
Contributor Author

7ombie commented Feb 8, 2024

Thanks for taking the time.

Colon isn't special-cased as far as I'm aware. You can rebind the command_mode command to another key and remap :.

I didn't know that. I just assumed, based on the docs.

I've reopened #5734 which talks about finding a convenient way to remap those.

Thank you. Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants