Skip to content

Instantly share code, notes, and snippets.

@Araeos
Forked from h14i/tmux-mouse-toggle
Last active August 29, 2015 14:25
Show Gist options
  • Save Araeos/f7d1c25cfa7fac5885ae to your computer and use it in GitHub Desktop.
Save Araeos/f7d1c25cfa7fac5885ae to your computer and use it in GitHub Desktop.
# tmux-mouse-toggle
# via http://qiita.com/kawaz/items/7b15e18ca8e072c1dc57
#
# Changes:
# - Modified 2015-07-27 by Araeos: modified shell code to work inline the .tmux.conf file with key binding.
# - Original gist by h14i
bind-key m run-shell "if [[ -n \$TMUX ]]; then \
if [[ -z \"$(tmux show-options -gw mode-mouse | grep off)\" ]]; then \
tmux set-option -gq mouse-utf8 off; \
tmux set-option -gq mouse-resize-pane off; \
tmux set-option -gq mouse-select-pane off; \
tmux set-option -gq mouse-select-window off; \
tmux set-window-option -gq mode-mouse off; \
tmux display-message \"Mouse: OFF\"; \
else \
tmux set-option -gq mouse-utf8 on; \
tmux set-option -gq mouse-resize-pane on; \
tmux set-option -gq mouse-select-pane on; \
tmux set-option -gq mouse-select-window on; \
tmux set-window-option -gq mode-mouse on; \
tmux display-message \"Mouse: ON\"; \
fi; \
exit 0; \
else \
echo \"not tmux session\"; \
exit 1; \
fi"
# vim: set ft=zsh:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment