Skip to content

Instantly share code, notes, and snippets.

@ssh0
Created November 29, 2015 01:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ssh0/7d706c020e44abe6e88b to your computer and use it in GitHub Desktop.
[tmux] ペイン移動,削除の際にウィンドウ名をリネームする ref: http://qiita.com/ssh0/items/b12afb372ac48814a17a
# if session has > 1 windows in current, kill-pane without confirmation.
# But confirm before killing pane when it is the last pane in the window.
bind-key -n M-c if "tmux display -p \"#{window_panes}\" | grep ^1\$" \
"confirm-before -p \"Kill the only pane in the window? It will kill this window too. (y/n)\" kill-pane" \
"kill-pane \; run 'tmux rename-window \"#{pane_current_command}\"'"
# move between panes with Alt+j/k
bind-key -n M-j select-pane -t :.+ \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-k select-pane -t :.- \; run 'tmux rename-window "#{pane_current_command}"'
# join pane with Alt+H/L
bind-key -n M-L join-pane -t :+ \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-H join-pane -t :- \; run 'tmux rename-window "#{pane_current_command}"'
# swap pane to Alt+shift+number
bind-key -n M-! join-pane -t :1 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-'"' join-pane -t :2 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-'#' join-pane -t :3 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-'$' join-pane -t :4 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-% join-pane -t :5 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-& join-pane -t :6 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-"'" join-pane -t :7 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-( join-pane -t :8 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-) join-pane -t :9 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-( join-pane -t :8 \; run 'tmux rename-window "#{pane_current_command}"'
bind-key -n M-) join-pane -t :9 \; run 'tmux rename-window "#{pane_current_command}"'
run 'tmux rename-window "#{pane_current_command}"'
rename-window "#{pane_current_command}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment