zsh: adjust profile/.zshenv for zsh and add .zshrc
This commit is contained in:
parent
a52bc02768
commit
cf01371f00
3 changed files with 36 additions and 23 deletions
|
@ -41,6 +41,7 @@ ${XDG_CONFIG_HOME}/tmux
|
|||
${XDG_CONFIG_HOME}/nvim
|
||||
${XDG_CONFIG_HOME}/nvim/autoload
|
||||
${XDG_CONFIG_HOME}/shell
|
||||
${XDG_CONFIG_HOME}/zsh
|
||||
${XDG_DATA_HOME}/bash
|
||||
${XDG_DATA_HOME}/bash-completion/completions
|
||||
${XDG_DATA_HOME}/less
|
||||
|
@ -57,6 +58,7 @@ files/bashrc ${HOME}/.bashrc
|
|||
files/bash_profile ${HOME}/.bash_profile
|
||||
files/jupyter_custom.js ${HOME}/.jupyter/custom/custom.js
|
||||
files/jupyter_notebook.json ${HOME}/.jupyter/nbconfig/notebook.json
|
||||
files/profile.sh ${HOME}/.zshenv
|
||||
files/ssh_config ${HOME}/.ssh/config
|
||||
files/alacritty.yml ${XDG_CONFIG_HOME}/alacritty/alacritty.yml
|
||||
files/gitconfig ${XDG_CONFIG_HOME}/git/config
|
||||
|
@ -70,6 +72,7 @@ files/init.vim ${XDG_CONFIG_HOME}/nvim/init.vim
|
|||
files/aliases.sh ${XDG_CONFIG_HOME}/shell/aliases.sh
|
||||
files/profile.sh ${XDG_CONFIG_HOME}/shell/profile.sh
|
||||
files/solarized.sh ${XDG_CONFIG_HOME}/shell/solarized.sh
|
||||
files/zshrc ${XDG_CONFIG_HOME}/zsh/.zshrc
|
||||
EOF
|
||||
)
|
||||
|
||||
|
|
|
@ -23,38 +23,40 @@ export LOCAL_CONFIG="$HOME/.local/etc"
|
|||
export LOCAL_PREFIX="/usr/local"
|
||||
export PAGER=less
|
||||
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py"
|
||||
|
||||
if command -v manpath >/dev/null 2>&1; then
|
||||
MANPATH="$(unset MANPATH; manpath)"
|
||||
export MANPATH
|
||||
fi
|
||||
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|
||||
|
||||
# Prevent path_helper from messing with the PATH when starting tmux.
|
||||
# See: https://superuser.com/a/583502
|
||||
[ "$(uname -s)" == "Darwin" ] && { PATH=""; source /etc/profile; }
|
||||
|
||||
_prepend_path() { # prepend $1 to var $2 avoiding duplicates using : as separator
|
||||
if [ -d "$1" ] && [ -n "$2" ]; then
|
||||
local _path="${!2}" # get path variable value
|
||||
case ":$_path:" in
|
||||
*":$1:"*) :;; # dir already in path, noop (:)
|
||||
*) _path="$1${_path:+:}$_path";; # prepend (adding : if not empty)
|
||||
esac
|
||||
printf -v "$2" "%s" "$_path" # write back to path variable
|
||||
fi
|
||||
}
|
||||
[ "$(uname -s)" = "Darwin" ] && { PATH=""; source /etc/profile; }
|
||||
|
||||
# Add custom bin dirs to PATH if they exist and are not already in PATH.
|
||||
while read -r dir; do
|
||||
case ":${PATH:=$dir}:" in
|
||||
*:"$dir":*) ;;
|
||||
*) PATH="$dir:$PATH" ;;
|
||||
esac
|
||||
done <<EOL
|
||||
$LOCAL_PREFIX/bin
|
||||
$HOME/.local/bin
|
||||
EOL
|
||||
export PATH
|
||||
|
||||
# Prepend custom man directories to MANPATH if they exist, so that we get
|
||||
# correct man page entries when multiple versions of a command are
|
||||
# available.
|
||||
while read -r var dir; do _prepend_path "$dir" "$var"; done <<EOL
|
||||
PATH $LOCAL_PREFIX/bin
|
||||
MANPATH $LOCAL_PREFIX/share/man
|
||||
PATH $HOME/.local/bin
|
||||
MANPATH $HOME/.local/share/man
|
||||
[ command -v manpath >/dev/null 2>&1 ] && MANPATH="$(unset MANPATH; manpath)"
|
||||
while read -r dir; do
|
||||
case ":${MANPATH:=$dir}:" in
|
||||
*:"$dir":*) ;;
|
||||
*) MANPATH="$dir:$MANPATH" ;;
|
||||
esac
|
||||
done <<EOL
|
||||
$LOCAL_PREFIX/share/man
|
||||
$HOME/.local/share/man
|
||||
EOL
|
||||
unset var dir _prepend_path
|
||||
export MANPATH
|
||||
|
||||
unset dir
|
||||
|
||||
# This check has to be done after PATH manipulation above so we can find brew.
|
||||
if command -v brew >/dev/null 2>&1; then
|
||||
|
|
8
files/zshrc
Normal file
8
files/zshrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/zsh
|
||||
# Set up zsh for interactive use (options, prompt, aliases, etc.)
|
||||
|
||||
stty -ixon # disable ctrl-s and ctrl-q
|
||||
|
||||
[ -f "${XDG_CONFIG_HOME}/shell/aliases.sh" ] && source "${XDG_CONFIG_HOME}/shell/aliases.sh"
|
||||
[ -f "${XDG_CONFIG_HOME}/shell/solarized.sh" ] && source "${XDG_CONFIG_HOME}/shell/solarized.sh"
|
||||
|
Loading…
Add table
Reference in a new issue