kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.41k stars 980 forks source link

Ability to change keybinds inside of start_resizing_window mode? #7334

Closed jacobrreed closed 6 months ago

jacobrreed commented 6 months ago

Is your feature request related to a problem? Please describe. https://sw.kovidgoyal.net/kitty/actions/#action-start_resizing_window -> currently when you enter resize mode it uses certain keybinds, i.e W for wider, N for narrower, T for taller, S for shorter, R for reset. Would be nice to be able to change these binds

Describe the solution you'd like Some option to customize these binds, I would like on entering resize mode to use vim like binds, i.e j for shorter, k for taller, h for wider, and l for narrower

Describe alternatives you've considered Currently im binding alternate bind i.e ctrl+t>j to manually resize_window shorter but would like to use start_resizing_window instead

Additional context Add any other context or screenshots about the feature request here.

kovidgoyal commented 6 months ago

You can use advanced keyboard mapping for this. See https://sw.kovidgoyal.net/kitty/mapping/

First, create a new keyboard mode that uses the send_key action to trnsalate hjkl to wtns or whatever you like

Then map a shortcut using combine that both starts resizing mode and also switches to the custom mode you created.

jacobrreed commented 6 months ago

You can use advanced keyboard mapping for this. See https://sw.kovidgoyal.net/kitty/mapping/

First, create a new keyboard mode that uses the send_key action to trnsalate hjkl to wtns or whatever you like

Then map a shortcut using combine that both starts resizing mode and also switches to the custom mode you created.

So im new to kitty so im definitely doing this wrong:

map --new-mode resizing f12
map --mode resizing j send_key s
map --mode resizing k send_key t
map --mode resizing l send_key n
map --mode resizing h send_key w
map --mode resizing esc pop_keyboard_mode
map ctrl+t>r combine : push_keyboard_mode resizing : start_resizing_window

something like this? I know im missing something here because it doesn't work, also do i have to bind to a key for the mode? can i just create a keyboard mode somehow with a name, the on my combine push keyboard mode and start_resizing_window or something?

thanks for any help @kovidgoyal

kovidgoyal commented 6 months ago

That should work fine, but note that you can also just map resizing actions directly without going through the window, see https://sw.kovidgoyal.net/kitty/layouts/#window-resizing

jacobrreed commented 6 months ago

That should work fine, but note that you can also just map resizing actions directly without going through the window, see https://sw.kovidgoyal.net/kitty/layouts/#window-resizing

ya im doing that as well, oh well thanks for the help

jacobrreed commented 6 months ago

ended up just doing this, works nice

map --new-mode resizing ctrl+t>r
map --mode resizing j resize_window shorter
map --mode resizing k resize_window taller
map --mode resizing l resize_window wider
map --mode resizing h resize_window narrower
map --mode resizing esc pop_keyboard_mode