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

Allow customize key options #79

Closed
wants to merge 1 commit into from
Closed

Conversation

fcsonline
Copy link
Owner

Trying to fix this: #77

tmux-thumbs.tmux Outdated
THUMBS_KEY="$(tmux show-option -gqv @thumbs-key)"
THUMBS_KEY=${THUMBS_KEY:-$DEFAULT_THUMBS_KEY}

tmux bind-key "${THUMBS_KEY}" run-shell -b "${CURRENT_DIR}/tmux-thumbs.sh"
tmux bind-key "${THUMBS_KEY_OPTIONS}" "${THUMBS_KEY}" run-shell -b "${CURRENT_DIR}/tmux-thumbs.sh"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would send an empty (zero length string) argument to tmux by default. A small test shows tmux doesn't like it:

$ tmux bind-key "" "X" display-message hello
unknown key:
exit 1

$ p tmux bind-key "" "X" display-message hello
["tmux", "bind-key", "", "X", "display-message", "hello"]

Essentially, you need to avoid sending the empty argument to tmux by default. Relaxing the quoting discipline is one way to solve this. But since you wish to maintain the quoting discipline, an explicit if-statement would also solve this:

if [ -n "${THUMBS_KEY_OPTIONS}" ]; then
  tmux bind-key "${THUMBS_KEY_OPTIONS}" "${THUMBS_KEY}" run-shell -b "${CURRENT_DIR}/tmux-thumbs.sh"
else
  tmux bind-key "${THUMBS_KEY}" run-shell -b "${CURRENT_DIR}/tmux-thumbs.sh"
fi

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, got it. Although I'm going to try another approach because this last if is duplicating a bit the logic.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try again with the latest code?

@fcsonline fcsonline force-pushed the feature/key-options branch from 09ec6f1 to 8f95d2b Compare March 7, 2021 18:50
@fcsonline fcsonline changed the title Allow customize key otpions Allow customize key options Mar 11, 2021
@fcsonline
Copy link
Owner Author

Closing this PR because of this: #94

@fcsonline fcsonline closed this Sep 2, 2021
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

Successfully merging this pull request may close these issues.

2 participants