Kitty: Prefix key: How to `map ctrl+space c new_window`

Created on 21 Feb 2018  路  7Comments  路  Source: kovidgoyal/kitty

  • Is it possible to map functions to keys in the way one would in tmux/screen, i.e. with a prefix key?
    I'd like to do things like the following in kitty.conf:
map ctrl+space c new_window
map ctrl+space space next_layout
  • I find the prefix key model easy on the wrists instead of having to press ctrl+shift+key for the common case.

p.s. Thanks for introducing the combine keyword for mapped functions.

enhancement help wanted

Most helpful comment

This is implemented in the xkb branch.

All 7 comments

No, it's not possible, but it should not be hard to add, it would basically work like combine, except that it would put the keyboard handler into an "operator pending" mode where it soaks up the next keypress and dispatches the action based on it. Something like:

map ctrl+space prefixed_cmd <key> <function>

Just FYI, there were two reasons I chose ctrl+shift as kitty's base modifier:

1) It cannot be used for most terminal programs
2) At least on my keyboard, you can press both ctrl and shift together using only a single thumb. This is why I did not add a prefix mode in the first place. To me, pressing ctrl+shift+ is easier than pressing ctrl+ followed by

  1. At least on my keyboard, you can press both ctrl and shift together using only a single thumb. This is why I did not add a prefix mode in the first place. To me, pressing ctrl+shift+ is easier than pressing ctrl+ followed by [...]

I see. I've just tried getting used to my left thumb on ctrl+shift. I can definitely see how it could be easier and more efficient in many cases. But I find myself having to take my hands off the home row: usually my left pinky hits capslock (swapcaps) and my right hand finger hits whichever prefix key is configured.

Also, perhaps the 'operator pending' mode you described could make it possibly for an entirely mouseless use of kitty when selecting regions to copy?

Thanks again.

You can already do completely mouse free selecting of regions to copy, just press ctrl+shift+h and configure the pager used for it in kitty.conf (defaults to less) to be something that supports keyboard selection, such as vimpager. You can even (if you are running kitty from master) click urls using only the keyboard (ctrl+shift+e).

I looked into this, and while it is trivial to implement in kitty itself, it cannot be made robust because of limitations in glfw. Basically, the glfw keyboard API is too limited to make this work. See https://github.com/glfw/glfw/issues/1140 until I get around to implementing the new keybaord API for glfw, this is not possibel to implement.

Okay. Thanks again @kovidgoyal. (Incidentally, I'm also getting faster and more comfortable using left-small-finger-on-shift + left-index-on-capslock.)

This is implemented in the xkb branch.

Thank you, sir!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Jomik picture Jomik  路  4Comments

lazarcf picture lazarcf  路  4Comments

RedBeard0531 picture RedBeard0531  路  4Comments

jasminabasurita picture jasminabasurita  路  3Comments

Nudin picture Nudin  路  3Comments