From f58f9a723bbcc252e44ef3548b75207982a283e9 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 21 Feb 2023 09:44:47 -0600 Subject: [PATCH] zexists changes --- home/private_dot_config/zsh/functions/envsubst | 13 ------------- .../zsh/plugins/zexists/zexists.plugin.zsh | 14 +++++++------- .../zsh/zexists.d/cmd/anti-envsubst.zsh | 6 ++++++ home/private_dot_config/zsh/zexists.d/cmd/tmux.zsh | 2 +- .../{dir-DOLLAR-HOME-SLASH-bun => dir--DOT-bun} | 0 .../{dir-DOLLAR-HOME-SLASH-.deno => dir--DOT-deno} | 0 ...r-DOLLAR-HOME-SLASH-.nimble => dir--DOT-nimble} | 0 ...ud-sdk => dir--DOT-pkgs-SLASH-google-cloud-sdk} | 0 ...DOLLAR-HOME-SLASH-mambaforge => dir-mambaforge} | 0 9 files changed, 14 insertions(+), 21 deletions(-) delete mode 100644 home/private_dot_config/zsh/functions/envsubst create mode 100644 home/private_dot_config/zsh/zexists.d/cmd/anti-envsubst.zsh rename home/private_dot_config/zsh/zexists.d/path/{dir-DOLLAR-HOME-SLASH-bun => dir--DOT-bun} (100%) rename home/private_dot_config/zsh/zexists.d/path/{dir-DOLLAR-HOME-SLASH-.deno => dir--DOT-deno} (100%) rename home/private_dot_config/zsh/zexists.d/path/{dir-DOLLAR-HOME-SLASH-.nimble => dir--DOT-nimble} (100%) rename home/private_dot_config/zsh/zexists.d/path/{dir-DOLLAR-HOME-SLASH-.pkgs-SLASH-google-cloud-sdk => dir--DOT-pkgs-SLASH-google-cloud-sdk} (100%) rename home/private_dot_config/zsh/zexists.d/path/{dir-DOLLAR-HOME-SLASH-mambaforge => dir-mambaforge} (100%) diff --git a/home/private_dot_config/zsh/functions/envsubst b/home/private_dot_config/zsh/functions/envsubst deleted file mode 100644 index d9c172e..0000000 --- a/home/private_dot_config/zsh/functions/envsubst +++ /dev/null @@ -1,13 +0,0 @@ -##? envsubst - fall-back wrapper in the event the envsubst command does not exist. - -if (( ! $+commands[envsubst] )); then - function envsubst { - command envsubst "$@" - } -else - function envsubst { - python -c 'import os,sys;[sys.stdout.write(os.path.expandvars(l)) for l in sys.stdin]' - } -fi - -# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/plugins/zexists/zexists.plugin.zsh b/home/private_dot_config/zsh/plugins/zexists/zexists.plugin.zsh index e8964d2..15c3f71 100644 --- a/home/private_dot_config/zsh/plugins/zexists/zexists.plugin.zsh +++ b/home/private_dot_config/zsh/plugins/zexists/zexists.plugin.zsh @@ -1,3 +1,5 @@ +#!/usr/bin/env zsh + function source-zshcmdd { setopt extended_glob @@ -35,15 +37,13 @@ function source-zshcmdd { source-zshcmdd function zshdir-decode { - # echo ${${1//--DOLLAR--/$}//--SLASH--/\/} | envsubst # for now just remove the 'dir' part - # :3 for 'dir' - echo ${${1//-DOLLAR-/$}//-SLASH-/\/} | envsubst + echo ${${1//-SLASH-//}/-DOT-/\.} } function zshdir-encode { # dir is hardcoded... - echo dir${${1//${HOME}/\-DOLLAR-HOME}//\//-SLASH-} + echo dir${${1//${HOME}\//}//\//-SLASH-} } @@ -82,12 +82,11 @@ function source-zshpathd { return 1 fi - # ignore files that begin with a tilde case ${rcfile:t} in '~'*) continue;; esac # remove 'dir' from name - name=${${rcfile:t}/$pathtype/} - directory=$(zshdir-decode ${name}) + name=${${rcfile:t}/${pathtype}-/} + directory=$HOME/$(zshdir-decode ${name}) # source files only if exe with that name exists if [[ -d $directory ]]; then source $rcfile @@ -101,3 +100,4 @@ function source-zshpathd { source-zshpathd +unset _envsubst diff --git a/home/private_dot_config/zsh/zexists.d/cmd/anti-envsubst.zsh b/home/private_dot_config/zsh/zexists.d/cmd/anti-envsubst.zsh new file mode 100644 index 0000000..7a3cb51 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/anti-envsubst.zsh @@ -0,0 +1,6 @@ +#!/usr/bin/env zsh + +function envsubst { + python -c 'import os,sys;[sys.stdout.write(os.path.expandvars(l)) for l in sys.stdin]' +} + diff --git a/home/private_dot_config/zsh/zexists.d/cmd/tmux.zsh b/home/private_dot_config/zsh/zexists.d/cmd/tmux.zsh index 87af9c2..0582d8b 100644 --- a/home/private_dot_config/zsh/zexists.d/cmd/tmux.zsh +++ b/home/private_dot_config/zsh/zexists.d/cmd/tmux.zsh @@ -3,6 +3,6 @@ alias t-labbook="$DOTFILES_DIR/tmux/labbook.sh" alias tmux="tmux -f $HOME/.config/tmux/tmux.conf" alias t='tmux' alias ta='tmux attach -t' -alias tn='tmux new-session' +alias tn='tmux new-session -s' alias tl='tmux list-sessions' diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-bun b/home/private_dot_config/zsh/zexists.d/path/dir--DOT-bun similarity index 100% rename from home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-bun rename to home/private_dot_config/zsh/zexists.d/path/dir--DOT-bun diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.deno b/home/private_dot_config/zsh/zexists.d/path/dir--DOT-deno similarity index 100% rename from home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.deno rename to home/private_dot_config/zsh/zexists.d/path/dir--DOT-deno diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.nimble b/home/private_dot_config/zsh/zexists.d/path/dir--DOT-nimble similarity index 100% rename from home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.nimble rename to home/private_dot_config/zsh/zexists.d/path/dir--DOT-nimble diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.pkgs-SLASH-google-cloud-sdk b/home/private_dot_config/zsh/zexists.d/path/dir--DOT-pkgs-SLASH-google-cloud-sdk similarity index 100% rename from home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.pkgs-SLASH-google-cloud-sdk rename to home/private_dot_config/zsh/zexists.d/path/dir--DOT-pkgs-SLASH-google-cloud-sdk diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-mambaforge b/home/private_dot_config/zsh/zexists.d/path/dir-mambaforge similarity index 100% rename from home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-mambaforge rename to home/private_dot_config/zsh/zexists.d/path/dir-mambaforge