From cf01371f00e4c7981f935397f3eb2b9fc86014c2 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sat, 7 Aug 2021 02:27:20 +0200 Subject: [PATCH] zsh: adjust profile/.zshenv for zsh and add .zshrc --- bootstrap | 3 +++ files/profile.sh | 48 +++++++++++++++++++++++++----------------------- files/zshrc | 8 ++++++++ 3 files changed, 36 insertions(+), 23 deletions(-) create mode 100644 files/zshrc diff --git a/bootstrap b/bootstrap index 845a87a..f7af921 100755 --- a/bootstrap +++ b/bootstrap @@ -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 ) diff --git a/files/profile.sh b/files/profile.sh index ca10213..b73b005 100644 --- a/files/profile.sh +++ b/files/profile.sh @@ -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 </dev/null 2>&1 ] && MANPATH="$(unset MANPATH; manpath)" +while read -r dir; do + case ":${MANPATH:=$dir}:" in + *:"$dir":*) ;; + *) MANPATH="$dir:$MANPATH" ;; + esac +done </dev/null 2>&1; then diff --git a/files/zshrc b/files/zshrc new file mode 100644 index 0000000..32c9350 --- /dev/null +++ b/files/zshrc @@ -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" +