diff --git a/README.md b/README.md index 916d00a..71cd9d3 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,17 @@ alias zq="zoxide query" alias zr="zoxide remove" ``` +#### fish +Using [fisher](https://github.com/jorgebucaran/fisher): +```sh +fisher add ajeetdsouza/zoxide +``` + +Using [oh-my-fish](https://github.com/oh-my-fish/oh-my-fish): +```sh +omf install https://github.com/ajeetdsouza/zoxide +``` + ## Configuration ### Environment variables diff --git a/functions/z.fish b/functions/z.fish new file mode 100644 index 0000000..1e05067 --- /dev/null +++ b/functions/z.fish @@ -0,0 +1,13 @@ +function z + if test (count $argv) -gt 0 + set _Z_RESULT (zoxide query $argv) + switch "$_Z_RESULT" + case 'query: *' + cd (string sub -s 8 -- "$_Z_RESULT") + commandline -f repaint + case '*' + echo -n "$_Z_RESULT" + end + end +end + diff --git a/init.fish b/init.fish new file mode 100644 index 0000000..7e5462f --- /dev/null +++ b/init.fish @@ -0,0 +1,8 @@ +function zoxide-add --on-event fish_prompt + zoxide add +end + +abbr -a zi "z -i" +abbr -a za "zoxide add" +abbr -a zq "zoxide query" +abbr -a zr "zoxide remove"