Initialize zoxide correctly, so I get proper completions

I used zoxide wrong all the time... By simply initiating it correctly it
immediately get's smarter and better. Imagine you have a dir like this:

  ~/deep/level/nested/but-with-very-specific-name/xy11-with-many-more

Imagine further that in your current directory is nothing that starts
with `xy`, then you only have to enter `cd xy` and zoxide will figure
out that you meant the deeply nested complicated name and change the
directory to there! - How awesome is that!

So, keep in mind use zoxide correct and it becomes easy to use!
This commit is contained in:
2025-09-18 15:03:04 +02:00
parent ff9dd116c2
commit ff2bdb2eca

13
.bashrc
View File

@@ -42,12 +42,6 @@ PROMPT_COMMAND="$HIST_LOG_COMMAND; $PROMPT_COMMAND"
unset HIST_LOG_DIR \
HIST_LOG_COMMAND
# init zoxide and set alias cd
which zoxide > /dev/null && eval "$(zoxide init bash)" && alias cd=z
# setup fzf to use it e.g. for Ctrl+r
which fzf > /dev/null && fzf --bash > /dev/null && eval "$(fzf --bash)"
# load bash_completion
__bash_completion_dir=/usr/share/bash-completion
test -n "$HOMEBREW_PREFIX" && __bash_completion_dir="$HOMEBREW_PREFIX/etc"
@@ -62,7 +56,14 @@ unset __bash_completion_dir
# nvm has this separated for whatever reason
test -r "$NVM_DIR/bash_completion" && . "$NVM_DIR/bash_completion"
# init zoxide and set alias cd
which zoxide > /dev/null && eval "$(zoxide init --cmd cd bash)"
# setup fzf to use it e.g. for Ctrl+r
which fzf > /dev/null && fzf --bash > /dev/null && eval "$(fzf --bash)"
# standard alias
alias z=cd
alias cz='(pushd $(git rev-parse --show-toplevel); $(which cz); popd)'
alias e='eza --icons --long --time-style=long-iso --group'
alias ls='eza --time-style=long-iso --group'