Files
dotfiles/.config/zsh/zshrc.d/35-nameddirs.zsh
Julian Prein cc076cc205 zsh:opts: Revert disabling CDABLE_VARS
This reverts commit a205a7c5ce ("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.
2023-12-04 20:47:39 +01:00

35 lines
895 B
Bash

## Author: druckdev
## Created: 2021-07-21
# Children of HOME
# for dir in "$HOME"/[^.]*(/); do
# [[ ! ${dir:t} =~ " " ]] || continue
# hash -d -- ${dir:t}="$dir"
# done
# Children of documents
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 [[ -e ~/projs ]]; then
hash -d dot{,s}=~/projs/dotfiles
fi
# Most recent semester folder
if (( $+nameddirs[uni] )); then
# Use the first match in ~uni/[0-9][0-9]-{s,w}s sorted in descending
# numeric order (most recent semester). The echo is necessary as else
# filename generation will include the wise= and nothing is matched.
# TODO!
hash -d sose="$(echo ~uni/[0-9][0-9]ss(NnOn[1]))"
hash -d wise="$(echo ~uni/[0-9][0-9]ws(NnOn[1]))"
hash -d ss="$nameddirs[sose]"
hash -d ws="$nameddirs[wise]"
fi