From cc076cc2057521fe29f6091c4e5fb5e83b853eb9 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Mon, 4 Dec 2023 20:44:22 +0100 Subject: [PATCH] zsh:opts: Revert disabling CDABLE_VARS This reverts commit a205a7c5cea39e5 ("zsh:opts: Disable CDABLE_VARS"). The main reason why the option annoyed me was primarily because I had stupid named dirs to begin with. Remove children of HOME, since I get there fast anyways. --- .config/zsh/zshrc.d/10-options.zsh | 6 ++++++ .config/zsh/zshrc.d/35-nameddirs.zsh | 23 +++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.config/zsh/zshrc.d/10-options.zsh b/.config/zsh/zshrc.d/10-options.zsh index 05522dd..e35c0de 100644 --- a/.config/zsh/zshrc.d/10-options.zsh +++ b/.config/zsh/zshrc.d/10-options.zsh @@ -8,6 +8,12 @@ # Make cd push the old directory onto the directory stack. setopt AUTO_PUSHD + # If the argument to a cd command (or an implied cd with the AUTO_CD option + # set) is not a directory, and does not begin with a slash, try to expand + # the expression as if it were preceded by a `~' (see the section `Filename + # Expansion'). + setopt CDABLE_VARS + # Resolve symbolic links to their true values when changing directory. This # also has the effect of CHASE_DOTS, i.e. a `..' path segment will be # treated as referring to the physical parent, even if the preceding path diff --git a/.config/zsh/zshrc.d/35-nameddirs.zsh b/.config/zsh/zshrc.d/35-nameddirs.zsh index 868f0df..afbdd07 100644 --- a/.config/zsh/zshrc.d/35-nameddirs.zsh +++ b/.config/zsh/zshrc.d/35-nameddirs.zsh @@ -2,24 +2,23 @@ ## Created: 2021-07-21 # Children of HOME -for dir in "$HOME"/[^.]*(/); do - [[ ! ${dir:t} =~ " " ]] || continue - hash -d -- ${dir:t}="$dir" -done +# for dir in "$HOME"/[^.]*(/); do +# [[ ! ${dir:t} =~ " " ]] || continue +# hash -d -- ${dir:t}="$dir" +# done # Children of documents -hash="$(xdg-user-dir DOCUMENTS 2>/dev/null || echo docs)" -hash="$(basename "$hash")" -if (( $+nameddirs[$hash] )); then - hash -d cheat=~$hash/cheat_sheets - hash -d uni=~$hash/uni - hash -d work=~$hash/work +docs="$(xdg-user-dir DOCUMENTS 2>/dev/null)" +if [[ -e $docs ]]; then + hash -d cheat="$docs"/cheat_sheets + hash -d uni="$docs"/uni + hash -d work="$docs"/work fi unset hash # Dotfiles -if (( $+nameddirs[projs] )); then - hash -d dot{,s}=~projs/dotfiles +if [[ -e ~/projs ]]; then + hash -d dot{,s}=~/projs/dotfiles fi # Most recent semester folder