diff options
| -rw-r--r-- | zsh/env | 6 | ||||
| -rw-r--r-- | zsh/functions/_op | 4 | ||||
| -rw-r--r-- | zsh/rc | 10 |
3 files changed, 19 insertions, 1 deletions
@@ -1,7 +1,11 @@ # -*- mode: shell-script -*- +dotfiles_root() { + echo ${${(%):-%x}:A:h:h} +} + source_if_exists() { - [[ -f ${${(%):-%x}:A:h:h}/$1 ]] && . ${${(%):-%x}:A:h:h}/$1 || return 0 + [[ -f $(dotfiles_root)/$1 ]] && . $(dotfiles_root)/$1 || return 0 } export DOMAIN=${$(cut -d. -f2- -s <<<${HOST}):l} diff --git a/zsh/functions/_op b/zsh/functions/_op new file mode 100644 index 0000000..26f4e3a --- /dev/null +++ b/zsh/functions/_op @@ -0,0 +1,4 @@ +#compdef op + +eval "$(op completion zsh)" +_op $@ @@ -1,5 +1,15 @@ # -*- mode: shell-script -*- +() { + local dir + for dir ( + $(dotfiles_root)/zsh/functions + $(dotfiles_root)/dotfiles-{${UNAME},${DOMAIN},${HOST}}/zsh/functions + ); do + [[ -d ${dir} ]] && fpath=(${dir} ${fpath}) + done +} + autoload -Uz compinit zmv [[ ! -d ${XDG_CACHE_HOME}/zsh ]] && mkdir -p ${XDG_CACHE_HOME}/zsh |
