From ff2bdb2eca8b0db169d93fff46ceae15f1da8ba3 Mon Sep 17 00:00:00 2001 From: Felix Nehrke Date: Thu, 18 Sep 2025 15:03:04 +0200 Subject: [PATCH] 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! --- .bashrc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.bashrc b/.bashrc index b3a6f79..b891454 100644 --- a/.bashrc +++ b/.bashrc @@ -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'