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

Can't bind / in keybindings.conf #14

Open
slacksystem opened this issue May 8, 2024 · 1 comment
Open

Can't bind / in keybindings.conf #14

slacksystem opened this issue May 8, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@slacksystem
Copy link

Hi,

I have added the following to my .tmux.conf:

set -g @modal-keybindings-conf ~/.tmux/conf/keybindings.conf
set -g @modal-commands-conf ~/.tmux/conf/commands.conf

in ~/.tmux/conf/keybindings.conf, in addition to the defaults, I have added

## Rename window.
KBD_WIN_RENAME=,

## Search within windows, only visible part, ignores case.
KBD_WIN_SEARCH='/'

##q Pane command prefix (same bindings as KBD_WIN but without the prefix).

and in ~/.tmux/conf/commands.conf

## Rename window.
CMD_WIN_RENAME='command-prompt -I "#W" "rename-window -- \"%%\""'

## Search within windows, only visible part, ignores case.
CMD_WIN_SEARCH='tmux command-prompt -p "Search for:" "find-window -Zi  %%"'

## Split command prefix.

(context included to indicate position)

I've tried both / and '/' as the values for KBD_WIN_SEARCH and neither seem to be bound. They don't do anything and list-keys doesn't have an entry for them. I've installed using tpm and when I add bind -T ktm-window '/' command-prompt -p "Search for:" "find-window -Zi %%" below run '~/.tmux/plugins/tpm/tpm' the keybind works, so there's a workaroubut otherwise it doesn't. I would think that any key that works with tmux bind-key should work in the config file. Any ideas why this isn't working?

@whame
Copy link
Owner

whame commented May 9, 2024

Adding new commands are unfortunately not supported. Only the ones already specified in commands.conf can be customized.

However, adding support for custom commands is maybe something we should add. I guess many would want this (and maybe bind stuff from other plugins). That's actually a really good idea!

Just designing it quickly on top of my head, I'm thinking we should have a "template" CMD_$KT_CUSTOM_*, where $KT is an existing key table. Users can then add whatever they want, e.g. in your case

CMD_WIN_CUSTOM_SEARCH='tmux command-prompt -p "Search for:" "find-window -Zi  %%"'

and correspondingly

KBD_WIN_CUSTOM_SEARCH='/'

This way we can identify and separate custom commands and their keybindings. Thanks for the idea! I'll see if I have time to cook something up this week.

@whame whame added the enhancement New feature or request label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants