Fix usage in user folder instead of global

This commit is contained in:
crater2150 2019-02-01 11:13:51 +01:00
parent b3e40ed202
commit 24bede8c5c
5 changed files with 35 additions and 12 deletions

View file

@ -53,8 +53,8 @@ E() {
# edit and refresh aliases
aliases() {
sudoedit /etc/zsh/aliases/${1:-functions}
. /etc/zsh/aliases/*
$EDITOR $(zdotfile aliases/${1:-functions})
. $(zdotfile aliases)/*
}
# per directory configuration

View file

@ -1,3 +1,3 @@
#compdef aliases
_files -W /etc/zsh/aliases/
_files -W $ZDOTDIR/aliases/

View file

@ -1,12 +1,10 @@
# autoload completions
fpath=( "${ZDOTDIR:+ZDOTDIR}/compdef" "/etc/zsh/compdef" $fpath )
autoload -U /etc/zsh/compdef/*(:t)
fpath=( "${ZDOTDIR:+$ZDOTDIR/compdef}" "/etc/zsh/compdef" $fpath )
if [[ -d $ZDOTDIR/compdef ]]; then
autoload -U /etc/zsh/compdef/*(N:t)
fi
[[ -n $(echo /etc/zsh/compdef/*(N:t)) ]] && autoload -U /etc/zsh/compdef/*(N:t)
[[ -n $(echo $ZDOTDIR/compdef/*(N:t)) ]] && autoload -U $ZDOTDIR/compdef/*(N:t)
autoload -Uz compinit && compinit
autoload -Uz compinit && compinit -u
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format %B%d%b

27
zshenv Normal file → Executable file
View file

@ -1,2 +1,25 @@
# prevent ZDOTDIR leaking when su'ing to another user
unset ZDOTDIR
export ZDOTDIR=$HOME/.config/zsh
ZMODLOAD_BLACKLIST=( ssh-agent )
export ZMODLOAD_BLACKLIST
if [ -n "$TMUX" ]; then export SHELL=/usr/bin/tmux; fi
export MAILDIR=$HOME/.maildir export NOTMUCH_CONFIG=$HOME/.config/notmuch-config
export GNUPGHOME="$XDG_CONFIG_HOME"/gnupg
export FZF_DEFAULT_COMMAND="fd"
export NPM_PACKAGES="${XDG_DATA_HOME}/npm-packages"
export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
PATH="$PATH:$HOME/.gem/ruby/2.5.0/bin"
PATH="$PATH:$NPM_PACKAGES/bin"
PATH="$PATH:$HOME/.local/bin"
PATH="$PATH:$XDG_DATA_HOME/android/sdk/tools"
export PATH
if command -v rustup &>/dev/null; then
export RUST_SRC_PATH=$(rustup run stable rustc --print sysroot)/lib/rustlib/src/rust/src
fi
if [[ -e $ZDOTDIR/dirs ]]; then
source $ZDOTDIR/dirs
fi

4
zshrc
View file

@ -14,6 +14,8 @@ setopt chase_links
setopt short_loops
setopt cdable_vars
export ZDOTDIR=${ZDOTDIR:-$HOME/.zsh}
# get a file from ZDOTDIR, return file in /etc/zsh if it does not exist
zdotfile() {
if [[ -e $ZDOTDIR/$1 ]]; then
@ -33,7 +35,7 @@ stty -ixon
. $(zdotfile modules/loader.zsh) && mod_init
for i in ${ZDOTDIR:+ZDOTDIR/aliases/*~*.zwc(N)} /etc/zsh/aliases/*~*.zwc(N); do
for i in ${ZDOTDIR:+$ZDOTDIR/aliases/*~*.zwc(N)} /etc/zsh/aliases/*~*.zwc(N); do
. $i
done