mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2025-01-14 19:10:36 +00:00
Changes based on PR review
This commit is contained in:
parent
e593051625
commit
5a2cbe0147
21
README.md
21
README.md
@ -4,13 +4,6 @@
|
||||
|
||||
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.
|
||||
@ -91,6 +84,20 @@ Using [fisher](https://github.com/jorgebucaran/fisher):
|
||||
fisher add ajeetdsouza/zoxide
|
||||
```
|
||||
|
||||
Using [omf](https://github.com/oh-my-fish/oh-my-fish):
|
||||
```sh
|
||||
omf install https://github.com/ajeetdsouza/zoxide
|
||||
```
|
||||
|
||||
To enable key bindings you have to set the universal variable `ZOXIDE_KEY_BINDINGS` to 1 and restart the shell.
|
||||
```fish
|
||||
set -U ZOXIDE_KEY_BINDINGS 1
|
||||
```
|
||||
|
||||
| Keybinding | Action |
|
||||
| ---------- | -------------------------------------------------------------------------------- |
|
||||
| <kbd>Alt</kbd>+<kbd>z</kbd> / <kbd>⌥</kbd>+<kbd>z</kbd> | Launch Zoxide in interactive mode |
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment variables
|
||||
|
@ -4,9 +4,12 @@ function z
|
||||
switch "$_Z_RESULT"
|
||||
case 'query: *'
|
||||
cd (string sub -s 8 -- "$_Z_RESULT")
|
||||
commandline -f repaint
|
||||
case '*'
|
||||
echo "$_Z_RESULT"
|
||||
if test -n "$_Z_RESULT"
|
||||
echo "$_Z_RESULT"
|
||||
end
|
||||
end
|
||||
commandline -f repaint
|
||||
end
|
||||
end
|
||||
|
||||
|
26
init.fish
26
init.fish
@ -1,14 +1,18 @@
|
||||
function zoxide-add --on-event fish_prompt
|
||||
if command -q zoxide
|
||||
zoxide add
|
||||
zoxide add
|
||||
end
|
||||
|
||||
set -q ZOXIDE_KEY_BINDINGS
|
||||
or set -U ZOXIDE_KEY_BINDINGS 0
|
||||
|
||||
abbr -a zi "z -i"
|
||||
abbr -a za "zoxide add"
|
||||
abbr -a zq "zoxide query"
|
||||
abbr -a zr "zoxide remove"
|
||||
|
||||
if set -q ZOXIDE_KEY_BINDINGS; and test "$ZOXIDE_KEY_BINDINGS" -eq 1
|
||||
bind \ez 'z -i'
|
||||
if bind -M insert >/dev/null 2>/dev/null
|
||||
bind -M insert \ez 'z -i'
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user