feat(tmux): ctrl+click a file path to open it by type

tmux-open-path takes the path under the mouse, strips :line:col, #L, @ and file:// decorations, and resolves it against the pane directory and then its git root. Markdown opens in Markdown Preview (added to Brewfile.apps), images, PDFs and directories in yazi, and everything else in nvim at the clicked line, both in a split beside the pane.
This commit is contained in:
David Ibia
2026-10-10 22:12:36 +01:00
parent 5fbdaa9810
commit d92041b6dd
4 changed files with 75 additions and 1 deletions
+5
View File
@@ -142,6 +142,11 @@ bind-key -T copy-mode-vi 'C-\' select-pane -l
set -g set-clipboard on
set -as terminal-features ',*:clipboard'
# Ctrl+click a file path in any pane (omo, shell, logs) to open it:
# markdown in Markdown Preview, images/pdf/dirs in yazi, the rest in nvim.
# yazi and nvim split beside the clicked pane. See ~/.local/bin/tmux-open-path.
bind -n C-MouseDown1Pane run-shell -b "~/.local/bin/tmux-open-path #{q:pane_id} #{q:pane_current_path} #{mouse_x} #{q:mouse_line}"
#
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'