tmux: Only match file paths with line numbers.
dblume

dblume commited on 2025-11-14 23:55:40
Showing 1 changed files, with 1 additions and 1 deletions.


Also match files that are just basenames and line numbers.
... ...
@@ -42,7 +42,7 @@ bind -n M-l select-pane -R
42 42
 # 2. Prefix + f to enter copy mode and search backward for a file path regex.
43 43
 # 3. Once found, Prefix + o to open the file in $EDITOR.
44 44
 bind-key f copy-mode \; send-keys -X search-backward \
45
-  '(^|/|\<|[[:space:]"])((\.|\.\.)|[[:alnum:]~_"-]*)((/[][[:alnum:]_.#$%&+=@"-]+)+([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)|(/[][[:alnum:]_.#$%&+=@"-]+){2,}([/ "]|\.([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?)|[][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)(:[0-9]+)?)?|(\.|\.\.)/([][[:alnum:]_.#$%&+=@"-]+(:[0-9]+)?(:[0-9]+)?))'
45
+   '(^|\<|[[:space:]/])("[/]?[[:alnum:] _\.#$%&+=@-]+(/[[:alnum:] _\.#$%&+=@-]+)*"(:[0-9]{1,10})(:[0-9]{1,10})?|[[:alnum:]_\.#$%&+=@-]+(/[[:alnum:]_\.#$%&+=@-]+)*([[:alnum:]_\.#$%&+=@-]+(:[0-9]{1,10})(:[0-9]{1,10})?))'
46 46
 
47 47
 # save the buffer, then open an editor in the current pane
48 48
 bind-key -T copy-mode-vi o send-keys -X copy-pipe-and-cancel \
49 49