Add fish integration

This commit is contained in:
Alin Panaitiu 2020-03-08 14:29:43 +02:00
parent bb72e14d23
commit e593051625
No known key found for this signature in database
GPG Key ID: E3629673D6E15976
3 changed files with 39 additions and 0 deletions

View File

@ -4,6 +4,13 @@
A cd command that learns your habits
## Table of contents
- [Installing `zoxide`](#installing-zoxide)
- [Adding `zoxide` to your shell](#adding-zoxide-to-your-shell)
+ [zsh](#zsh)
+ [fish](#fish)
## Introduction
`zoxide` is a new `cd` alternative inspired by [`z`](https://github.com/rupa/z) and [`z.lua`](https://github.com/skywind3000/z.lua). It keeps track of the directories you use most frequently, and uses a ranking algorithm to navigate to the best match.
@ -78,6 +85,12 @@ alias zq="zoxide query"
alias zr="zoxide remove"
```
#### fish
Using [fisher](https://github.com/jorgebucaran/fisher):
```sh
fisher add ajeetdsouza/zoxide
```
## Configuration
### Environment variables

12
functions/z.fish Normal file
View File

@ -0,0 +1,12 @@
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")
case '*'
echo "$_Z_RESULT"
end
commandline -f repaint
end
end

14
init.fish Normal file
View File

@ -0,0 +1,14 @@
function zoxide-add --on-event fish_prompt
if command -q zoxide
zoxide add
end
end
if command -q zoxide
abbr -a zi "z -i"
abbr -a za "zoxide add"
abbr -a zq "zoxide query"
abbr -a zr "zoxide remove"
bind \ez 'z -i'
end