Compare commits

...

5 Commits

5 changed files with 91 additions and 0 deletions

24
plugins/npm Normal file
View File

@ -0,0 +1,24 @@
#
# npm
#
# Install NPM packages globally without requiring sudo
# https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md
if command -v npm &> /dev/null; then
# Use XDG dirs
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/config"
export NPM_CONFIG_CACHE="$XDG_CACHE_HOME/npm"
export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR/npm"
export NPM_CONFIG_PREFIX="$XDG_DATA_HOME/npm"
# add npm binary directory to PATH
path+=("$NPM_CONFIG_PREFIX/bin")
export PATH
# Rare, but some npm packages install man pages...
MANPATH="$NPM_CONFIG_PREFIX/share/man:$(manpath)"
export MANPATH
fi
# vim: ft=zsh expandtab tabstop=2 shiftwidth=2

12
plugins/pyenv Normal file
View File

@ -0,0 +1,12 @@
#
# pyenv
#
# Add pyenv binary directory to PATH
if command -v pyenv &> /dev/null; then
export PYENV_ROOT="$HOME/.cache/pyenv"
PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"
export PATH
fi
# vim: ft=zsh expandtab tabstop=2 shiftwidth=2

11
plugins/ruby Normal file
View File

@ -0,0 +1,11 @@
#
# ruby
#
# Add rubygem binary directory to PATH
if command -v ruby &> /dev/null; then
path+=("$(ruby -e "puts Gem.user_dir")/bin")
export PATH
fi
# vim: ft=zsh expandtab tabstop=2 shiftwidth=2

16
plugins/rust Normal file
View File

@ -0,0 +1,16 @@
#
# rust
#
# Add Cargo binary directory to PATH
if command -v cargo &> /dev/null; then
# set CARGO_HOME if not set
if [ -z "${CARGO_HOME}" ]; then
export CARGO_HOME="$HOME/.cargo"
fi
path+=("$CARGO_HOME/bin")
export PATH
fi
# vim: ft=zsh expandtab tabstop=2 shiftwidth=2

28
source/xdg.zsh Normal file
View File

@ -0,0 +1,28 @@
#
# xdg base directory variables
#
# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
if [ -z "${XDG_CONFIG_HOME}" ]; then
export XDG_CONFIG_HOME="${HOME}/.config"
fi
if [ -z "${XDG_CACHE_HOME}" ]; then
export XDG_CACHE_HOME="${HOME}/.cache"
fi
if [ -z "${XDG_DATA_HOME}" ]; then
export XDG_DATA_HOME="${HOME}/.local/share"
fi
if [ -z "${XDG_STATE_HOME}" ]; then
export XDG_STATE_HOME="${HOME}/.local/state"
fi
# XDG_RUNTIME_DIR is set when using pam_systemd
if [[ "$OSTYPE" == "darwin"* ]]; then
export XDG_RUNTIME_DIR=/tmp
fi
# vim: ft=zsh expandtab tabstop=2 shiftwidth=2