Add zoxide
[webi-installers/.git] / zoxide / README.md
1 ---
2 title: zoxide
3 homepage: https://github.com/ajeetdsouza/zoxide
4 tagline: |
5   zoxide: A smarter cd command.
6 ---
7
8 ## Cheat Sheet
9
10 `zoxide` is a smarter `cd` command for your terminal. It keeps track of the
11 directories you visit, so that you can switch to them using just a few
12 keystrokes.
13
14 ![tutorial](https://github.com/ajeetdsouza/zoxide/raw/main/contrib/tutorial.webp)
15
16 ## Usage
17
18 ```sh
19 z foo       # cd to highest ranked directory matching foo
20 z foo bar   # cd to highest ranked directory matching foo and bar
21
22 z foo/      # can also cd into actual directories
23 z ..        # cd into parent directory
24 z -         # cd into previous directory
25
26 zi foo      # cd with interactive selection (requires fzf)
27 ```
28
29 ## Add zoxide to your shell
30
31 To use zoxide, it needs to be first initialized on your shell:
32
33 ### bash
34
35 Add the following line to your configuration file (usually `~/.bashrc`):
36
37 ```sh
38 eval "$(zoxide init bash)"
39 ```
40
41 ### elvish
42
43 Add the following line to your configuration file (usually `~/.elvish/rc.elv`):
44
45 ```sh
46 eval $(zoxide init elvish | slurp)
47 ```
48
49 ### fish
50
51 Add the following line to your configuration file (usually `~/.config/fish/config.fish`):
52
53 ```fish
54 zoxide init fish | source
55 ```
56
57 ### nushell
58
59 Initialize zoxide's Nushell script:
60
61 ```sh
62 zoxide init nushell --hook prompt | save ~/.zoxide.nu
63 ```
64
65 Then, in your Nushell configuration file:
66
67 - Prepend `__zoxide_hook;` to the `prompt` variable.
68 - Add the following lines to the `startup` variable:
69   - `zoxide init nushell --hook prompt | save ~/.zoxide.nu`
70   - `source ~/.zoxide.nu`
71
72 ### powershell
73
74 Add the following line to your profile:
75
76 ```powershell
77 Invoke-Expression (& {
78     $hook = if ($PSVersionTable.PSVersion.Major -lt 6) { 'prompt' } else { 'pwd' }
79     (zoxide init --hook $hook powershell) -join "`n"
80 })
81 ```
82
83 ### xonsh
84
85 Add the following line to your configuration file (usually `~/.xonshrc`):
86
87 ```python
88 execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide')
89 ```
90
91 ### zsh
92
93 Add the following line to your configuration file (usually `~/.zshrc`):
94
95 ```sh
96 eval "$(zoxide init zsh)"
97 ```
98
99 ### Any POSIX shell
100
101 Add the following line to your configuration file:
102
103 ```sh
104 eval "$(zoxide init posix --hook prompt)"
105 ```