-
Notifications
You must be signed in to change notification settings - Fork 446
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 command aliases #211
base: master
Are you sure you want to change the base?
Add command aliases #211
Conversation
I didn't know tmux had this feature! I wanted something like this for a long time. Too bad the manpage is so terse. Here are a couple thoughts on this:
Naming
|
I'm so much under the impression of what can be done with this tmux feature... |
@bruno- you have to dig for some stuff in the manual indeed) I very much agree on all the points and have updated the PR accordingly. Vim/Neovim plugins are already following this logic. I believe it to be very convenient when plugins implement commands first and then leave it up to the user to implement Fzf / completion / static bindings / use default bindings / etc for the quick access to the features they provide. Few things to consider:
Please share any other requirements that need to be implemented. |
Thank you for making the changes, almost all of them are great. So, I made a bunch of comments above while I was under the initial impression of what's possible with this feature. After sleeping on it for a couple days and looking at your changes I have some fresh thoughts. Hopefully you are ok with this slow process? The impact of the changes we make here is big. New thoughts:
If you can find tmux version when
Thoughts related to commands, but not related for this PR:
|
@bruno- agree with your point regarding command naming. Just think this should be opt-out feature in case someone might have their own meaning for these commands. Or make both EDIT: if we take a look at the vim plugin managers, i believe, they have their plugin name as prefixes as common practice. Maybe we could just explain to the user in the README that: hey, you can make the commands more convenient for yourself, if you wish, here is the snippet, put it in your tmux.conf |
# tpm-update - updates a plugin (or all of them) and reloads TMUX environment | ||
# tpm-clean - remove unused TPM plugins and reloads TMUX environment | ||
set_tpm_commands() { | ||
tmux set-option -ag command-alias "tpm-install=run-shell $COMMANDS_DIR/tpm-install" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement isn't idempotent because of the -a
flag, so be careful. If someone reloads their config, this file could get sourced again and append duplicate aliases. tmux seems to use the first registered alias for a given key, so subsequent calls to set_tpm_commands
would effectively be ignored until a new session is started.
I also noticed a bug where using -a
causes aliases that contain commas to be split across multiple entries. This shouldn't be an issue for this PR, but it makes me feel like using -a
with array options like command-alias
isn't fully tested.
Added aliases with the same function as the bindings and the option
@tpm-aliases
to enable/disable them. In the current PR the option ison
by default. Should this be changed to 'off' for the backward compatibility?