diff options
Diffstat (limited to 'home-config/fish/functions')
-rw-r--r-- | home-config/fish/functions/__zoxide_cd.fish | 6 | ||||
-rw-r--r-- | home-config/fish/functions/__zoxide_pwd.fish | 7 | ||||
-rw-r--r-- | home-config/fish/functions/__zoxide_z.fish | 13 | ||||
-rw-r--r-- | home-config/fish/functions/__zoxide_z_complete.fish | 15 | ||||
-rw-r--r-- | home-config/fish/functions/__zoxide_zi.fish | 4 |
5 files changed, 45 insertions, 0 deletions
diff --git a/home-config/fish/functions/__zoxide_cd.fish b/home-config/fish/functions/__zoxide_cd.fish new file mode 100644 index 0000000..d5a8b2b --- /dev/null +++ b/home-config/fish/functions/__zoxide_cd.fish | |||
@@ -0,0 +1,6 @@ | |||
1 | function __zoxide_cd | ||
2 | __zoxide_cd_internal $argv | ||
3 | if test "$_ZO_ECHO" = 1 | ||
4 | __zoxide_pwd | ||
5 | end | ||
6 | end | ||
diff --git a/home-config/fish/functions/__zoxide_pwd.fish b/home-config/fish/functions/__zoxide_pwd.fish new file mode 100644 index 0000000..49f9357 --- /dev/null +++ b/home-config/fish/functions/__zoxide_pwd.fish | |||
@@ -0,0 +1,7 @@ | |||
1 | function __zoxide_pwd | ||
2 | if test "$_ZO_RESOLVE_SYMLINKS" = 1 | ||
3 | builtin pwd -P | ||
4 | else | ||
5 | builtin pwd -L | ||
6 | end | ||
7 | end | ||
diff --git a/home-config/fish/functions/__zoxide_z.fish b/home-config/fish/functions/__zoxide_z.fish new file mode 100644 index 0000000..bb24f69 --- /dev/null +++ b/home-config/fish/functions/__zoxide_z.fish | |||
@@ -0,0 +1,13 @@ | |||
1 | function __zoxide_z | ||
2 | set --local argc (count $argv) | ||
3 | if test $argc -eq 0 | ||
4 | __zoxide_cd $HOME | ||
5 | else if test "$argv" = - | ||
6 | __zoxide_cd - | ||
7 | else if test $argc -eq 1 -a -d $argv[1] | ||
8 | __zoxide_cd $argv[1] | ||
9 | else | ||
10 | set --local result (command zoxide query --exclude (__zoxide_pwd) -- $argv) | ||
11 | and __zoxide_cd $result | ||
12 | end | ||
13 | end | ||
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 @@ | |||
1 | function __zoxide_z_complete | ||
2 | set --local tokens (commandline --current-process --tokenize) | ||
3 | set --local curr_tokens (commandline --cut-at-cursor --current-process --tokenize) | ||
4 | |||
5 | if test (count $tokens) -le 2 -a (count $curr_tokens) -eq 1 | ||
6 | # If there are < 2 arguments, use `cd` completions. | ||
7 | __fish_complete_directories "$tokens[2]" '' | ||
8 | else if test (count $tokens) -eq (count $curr_tokens) | ||
9 | # If the last argument is empty, use interactive selection. | ||
10 | set --local query $tokens[2..-1] | ||
11 | set --local result (zoxide query --interactive -- $query) | ||
12 | commandline --current-process "$tokens[1] "(string escape $result) | ||
13 | commandline --function repaint | ||
14 | end | ||
15 | end | ||
diff --git a/home-config/fish/functions/__zoxide_zi.fish b/home-config/fish/functions/__zoxide_zi.fish new file mode 100644 index 0000000..35837ac --- /dev/null +++ b/home-config/fish/functions/__zoxide_zi.fish | |||
@@ -0,0 +1,4 @@ | |||
1 | function __zoxide_zi | ||
2 | set --local result (command zoxide query --interactive -- $argv) | ||
3 | and __zoxide_cd $result | ||
4 | end | ||