From a8b7e972ead8df887f06537ccc017fe556f43fd3 Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Fri, 12 Apr 2024 23:09:46 -0400 Subject: added zoxide helper plugin --- home-config/fish/functions/__zoxide_z_complete.fish | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 home-config/fish/functions/__zoxide_z_complete.fish (limited to 'home-config/fish/functions/__zoxide_z_complete.fish') diff --git a/home-config/fish/functions/__zoxide_z_complete.fish b/home-config/fish/functions/__zoxide_z_complete.fish new file mode 100644 index 0000000..9e6196f --- /dev/null +++ b/home-config/fish/functions/__zoxide_z_complete.fish @@ -0,0 +1,15 @@ +function __zoxide_z_complete + set --local tokens (commandline --current-process --tokenize) + set --local curr_tokens (commandline --cut-at-cursor --current-process --tokenize) + + if test (count $tokens) -le 2 -a (count $curr_tokens) -eq 1 + # If there are < 2 arguments, use `cd` completions. + __fish_complete_directories "$tokens[2]" '' + else if test (count $tokens) -eq (count $curr_tokens) + # If the last argument is empty, use interactive selection. + set --local query $tokens[2..-1] + set --local result (zoxide query --interactive -- $query) + commandline --current-process "$tokens[1] "(string escape $result) + commandline --function repaint + end +end -- cgit v1.2.3