From ef13b24e80fe99a44286fe82e9ef262dab4dd2f9 Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Sat, 31 Oct 2020 22:34:13 +0100 Subject: [PATCH] zsh:alias: Update named directories Update named directories location and rewrite the hash for wise and sose to use a solution without tail but only the zsh glob power. TODO: Find solution to get rid of the `echo` as well. --- .config/zsh/plugins/alias.zsh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.config/zsh/plugins/alias.zsh b/.config/zsh/plugins/alias.zsh index 0f194d4..16e07aa 100644 --- a/.config/zsh/plugins/alias.zsh +++ b/.config/zsh/plugins/alias.zsh @@ -106,14 +106,17 @@ }' # Named directories - hash -d docs="$HOME"/Documents/ - hash -d cheat="${nameddirs[docs]}"/cheat_sheets - hash -d proj="$HOME"/Projects/ - hash -d dot{,s}="${nameddirs[proj]}"/github/dotfiles-github/ - hash -d pics="$HOME"/Pictures/ - hash -d down="$HOME"/Downloads/ + hash -d docs=~/docs + hash -d down=~/downloads + hash -d pics=~/pics + hash -d proj=~/projs - hash -d uni="${nameddirs[docs]}"/uni - local UNI="${nameddirs[uni]}" - hash -d wise="$(printf "%s\n" "$UNI"/[0-9][0-9]-WiSe | tail -1)" - hash -d sose="$(printf "%s\n" "$UNI"/[0-9][0-9]-SoSe | tail -1)" + hash -d cheat=~docs/cheat_sheets + hash -d dot{,s}=~proj/dotfiles + hash -d uni=~docs/uni + + # 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]))"