zsh:nameddirs: Pull out of aliases into own file
This commit is contained in:
@@ -145,30 +145,4 @@
|
|||||||
(( ! $+commands[man] )) ||
|
(( ! $+commands[man] )) ||
|
||||||
alias man='nvim-man'
|
alias man='nvim-man'
|
||||||
|
|
||||||
# Named directories
|
|
||||||
for dir in "$HOME"/[^.]*(/); do
|
|
||||||
[[ ! ${dir:t} =~ " " ]] || continue
|
|
||||||
hash -d ${dir:t}="$dir"
|
|
||||||
done
|
|
||||||
|
|
||||||
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
|
|
||||||
fi
|
|
||||||
unset hash
|
|
||||||
if (( $+nameddirs[projs] )); then
|
|
||||||
hash -d dot{,s}=~projs/dotfiles
|
|
||||||
fi
|
|
||||||
if (( $+nameddirs[uni] )); then
|
|
||||||
# Use the first match in ~uni/[0-9][0-9]-{So,Wi}Se 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]-SoSe(NnOn[1]))"
|
|
||||||
hash -d wise="$(echo ~uni/[0-9][0-9]-WiSe(NnOn[1]))"
|
|
||||||
fi
|
|
||||||
|
|
||||||
unfunction add_flags is_exec
|
unfunction add_flags is_exec
|
||||||
|
|||||||
33
.config/zsh/zshrc.d/35-nameddirs.zsh
Normal file
33
.config/zsh/zshrc.d/35-nameddirs.zsh
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
## 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
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
unset hash
|
||||||
|
|
||||||
|
# Dotfiles
|
||||||
|
if (( $+nameddirs[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]-{So,Wi}Se 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]-SoSe(NnOn[1]))"
|
||||||
|
hash -d wise="$(echo ~uni/[0-9][0-9]-WiSe(NnOn[1]))"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user