changeset 822:0c2dcf35d759

feat: show fzf to select paths from last command output
author zegervdv <zegervdv@me.com>
date Mon, 25 Dec 2023 21:24:11 +0000
parents 03e120882791
children 2e86aa5360eb
files dot_tmux.conf
diffstat 1 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dot_tmux.conf	Fri Dec 15 08:05:00 2023 +0100
+++ b/dot_tmux.conf	Mon Dec 25 21:24:11 2023 +0000
@@ -164,5 +164,42 @@
 
 bind-key -T copy-mode-vi 's' send -X copy-pipe-and-cancel "cat > /tmp/error.txt && tmux new-window -n 'quickfix' -c \"#{pane_current_path}\" 'nvim -q /tmp/error.txt && rm -f /tmp/error.txt'"
 
+
+bind-key 'o' {
+  copy-mode
+  send -X clear-selection
+  send -X start-of-line
+  send -X start-of-line
+  send -X cursor-up
+  send -X cursor-up
+  send -X start-of-line
+  send -X start-of-line
+
+  if -F "#{m:*->\u00A0*,#{copy_cursor_line}}" {
+    send -X search-forward-text "->\u00A0"
+    send -X stop-selection
+    send -X -N 2 cursor-right
+    send -X begin-selection
+    send -X end-of-line
+    send -X end-of-line
+    if "#{m:*->\u00A0?*,#{copy_cursor_line}}" {
+      send -X cursor-left
+    }
+  } {
+    send -X end-of-line
+    send -X end-of-line
+    send -X begin-selection
+    send -X search-backward-text "->\u00A0"
+    send -X end-of-line
+    send -X end-of-line
+    send -X cursor-right
+    send -X stop-selection
+  }
+
+  send -X copy-pipe-and-cancel "grep -oE '([^\s]+)\/([^/]+)' | fzf-tmux -d20 --multi --bind alt-a:select-all,alt-d:deselect-all | paste -sd \" \" - | xargs -I {} tmux send-keys -t #{pane_id} \"{}\""
+
+}
+
+
 # unbind after loading plugins
 unbind -T copy-mode-vi MouseDragEnd1Pane