Skip to content

Instantly share code, notes, and snippets.

@unhammer
Last active November 2, 2020 09:14
Show Gist options
  • Save unhammer/7b9cf33fd3bb8416fc4a2220ce8bb4c0 to your computer and use it in GitHub Desktop.
Save unhammer/7b9cf33fd3bb8416fc4a2220ce8bb4c0 to your computer and use it in GitHub Desktop.
tmux double-click menu with "open in emacs" item
bind-key -T root DoubleClick1Pane 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})\" 'Open in Emacs' 'e' {run 'cd \"#{pane_current_path}\" && ~/bin/switch-to-emacsclient \"#{q:mouse_word}\"'} '' '#{?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} '' '#{?pane_marked,Unmark,Mark}' 'm' {select-pane -m} '#{?window_zoomed_flag,Unzoom,Zoom}' 'z' {resize-pane -Z}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment