Skip to content

Instantly share code, notes, and snippets.

@ipatch
Created January 10, 2020 21:16
Show Gist options
  • Select an option

  • Save ipatch/514e60d8eae01d7e461e68305d96316d to your computer and use it in GitHub Desktop.

Select an option

Save ipatch/514e60d8eae01d7e461e68305d96316d to your computer and use it in GitHub Desktop.
my tmux confusion 🤨
bind-key -n F12 display "F12 pressed" # no prefix key required
bind -n F12 display "F12 pressed" # requires prefix key before displaying message in status bar
# if i use `bind-key` instead of `bind` i can press `fn + F12` and see the message displayed in the status bar
# but if i use `bind` i have to press my `prefix` key first before pressing `fn + F12` to see the message displayed
# ...in the status bar even if i have the `-n` option set.
# i thought `bind` was alias to `bind-key` am i mistaken about this?
# os = macOS 10.13.6
# computer = macbook pro, hence the reason i have to press `fn + f12`
# tmux = 3.0a installed via brew
@ipatch
Copy link
Author

ipatch commented Jan 10, 2020

bind-key -T root C-h                   run-shell "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(vim|emacs)' && tmux send-keys C-h) || tmux select-pane -L"
bind-key -T root C-j                   run-shell "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(vim|emacs)' && tmux send-keys C-j) || tmux select-pane -D"
bind-key -T root C-k                   run-shell "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(vim|emacs)' && tmux send-keys C-k) || tmux select-pane -U"
bind-key -T root C-l                   run-shell "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(vim|emacs)' && tmux send-keys C-l) || tmux select-pane -R"
bind-key -T root MouseDown1Pane        select-pane -t = \; send-keys -M
bind-key -T root MouseDown1Status      select-window -t =
bind-key -T root MouseDown3Pane        if-shell -F -t = "#{||:#{mouse_any_flag},#{pane_in_mode}}" "select-pane -t=; send-keys -M" "display-menu -t= -xM -yM -T \"#[align=centre]#{pane_index} (#{pane_id})\"  '#{?mouse_word,Search For #[underscore]#{=/9/...:mouse_word},}' 'C-r' {copy-mode -t=; send -Xt= search-backward \"#{q:mouse_word}\"} '#{?mouse_word,Type #[underscore]#{=/9/...:mouse_word},}' 'C-y' {send-keys -l -- \"#{q:mouse_word}\"} '#{?mouse_word,Copy #[underscore]#{=/9/...:mouse_word},}' 'c' {set-buffer -- \"#{q:mouse_word}\"} '#{?mouse_line,Copy Line,}' 'l' {set-buffer -- \"#{q:mouse_line}\"} '' 'Horizontal Split' 'h' {split-window -h} 'Vertical Split' 'v' {split-window -v} '' 'Swap Up' 'u' {swap-pane -U} 'Swap Down' 'd' {swap-pane -D} '#{?pane_marked_set,,-}Swap Marked' 's' {swap-pane} '' 'Kill' 'X' {kill-pane} 'Respawn' 'R' {respawn-pane -k} '#{?pane_marked,Unmark,Mark}' 'm' {select-pane -m} '#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}"
bind-key -T root MouseDown3Status      display-menu -T "#[align=centre]#{window_index}:#{window_name}" -t = -x W -y S "Swap Left" l "swap-window -t:-1" "Swap Right" r "swap-window -t:+1" "#{?pane_marked_set,,-}Swap Marked" s swap-window  Kill X kill-window Respawn R "respawn-window -k" "#{?pane_marked,Unmark,Mark}" m "select-pane -m" Rename n "command-prompt -I \"#W\" \"rename-window -- '%%'\""  "New After" w "new-window -a" "New At End" W new-window
bind-key -T root MouseDown3StatusLeft  display-menu -T "#[align=centre]#{session_name}" -t = -x M -y S Next n "switch-client -n" Previous p "switch-client -p"  Renumber N "move-window -r" Rename n "command-prompt -I \"#S\" \"rename-session -- '%%'\""  "New Session" s new-session "New Window" w new-window
bind-key -T root MouseDown3StatusRight display-menu -T "#[align=centre]#{client_name}" -t = -x M -y S Detach d detach-client "Detach & Kill" X "detach-client -P" "Detach Others" o "detach-client -a"  Lock l lock-client
bind-key -T root MouseDrag1Pane        if-shell -F -t = "#{mouse_any_flag}" "if -Ft= \"#{pane_in_mode}\" \"copy-mode -M\" \"send-keys -M\"" "copy-mode -M"
bind-key -T root MouseDrag1Border      resize-pane -M
bind-key -T root WheelUpPane           if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= \"#{pane_in_mode}\" \"send-keys -M\" \"copy-mode -et=\""
bind-key -T root WheelUpStatus         previous-window
bind-key -T root WheelDownStatus       next-window
bind-key -T root F9                    select-pane -t next
bind-key -T root F12                   display-message "F12 pressed"
bind-key -T root M-MouseDown3Pane      display-menu -T "#[align=centre]#{pane_index} (#{pane_id})" -t = -x M -y M "#{?mouse_word,Search For #[underscore]#{=/9/...:mouse_word},}" C-r "copy-mode -t=; send -Xt= search-backward \"#{q:mouse_word}\"" "#{?mouse_word,Type #[underscore]#{=/9/...:mouse_word},}" C-y "send-keys -l -- \"#{q:mouse_word}\"" "#{?mouse_word,Copy #[underscore]#{=/9/...:mouse_word},}" c "set-buffer -- \"#{q:mouse_word}\"" "#{?mouse_line,Copy Line,}" l "set-buffer -- \"#{q:mouse_line}\""  "Horizontal Split" h "split-window -h" "Vertical Split" v "split-window -v"  "Swap Up" u "swap-pane -U" "Swap Down" d "swap-pane -D" "#{?pane_marked_set,,-}Swap Marked" s swap-pane  Kill X kill-pane Respawn R "respawn-pane -k" "#{?pane_marked,Unmark,Mark}" m "select-pane -m" "#{?window_zoomed_flag,Unzoom,Zoom}" z "resize-pane -Z"
bind-key -T root S-Up                  new-window -c "#{pane_current_path}"
bind-key -T root S-Down                new-window -c "#{pane_current_path}"
bind-key -T root S-Left                previous-window
bind-key -T root S-Right               next-window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment