diff options
Diffstat (limited to 'user/zsh')
-rw-r--r-- | user/zsh/.zshrc | 26 | ||||
-rw-r--r-- | user/zsh/zshrc-dev.sh | 11 | ||||
-rw-r--r-- | user/zsh/zshrc-graphical.sh | 16 |
3 files changed, 33 insertions, 20 deletions
diff --git a/user/zsh/.zshrc b/user/zsh/.zshrc index ba07dc2..a579784 100644 --- a/user/zsh/.zshrc +++ b/user/zsh/.zshrc @@ -22,9 +22,7 @@ function ls() { } ## Aliases -alias code='codium' alias ls='ls --color=auto --group-directories-first' # see also ls function -alias tokei='tokei -s code -n commas' alias tree='tree -aI .git --dirsfirst' ## Shell variables @@ -52,7 +50,6 @@ export XDG_CONFIG_HOME=$HOME/.config export EDITOR=vim export INPUTRC=$XDG_CONFIG_HOME/readline/inputrc -export NPM_CONFIG_PREFIX="$HOME/.local/npm" export PYTHON_BASIC_REPL=1 # use readline (Python >=3.13 defaults to its own REPL which has no vi keybindings) # If we'd extend the PATH with PATH=$PATH:extra the PATH would become longer with each subshell. @@ -60,26 +57,15 @@ export PYTHON_BASIC_REPL=1 # use readline (Python >=3.13 defaults to its own REP typeset -U path PATH # Now we can append PATH entries with path+=... without the PATH growing in each subshell. -path+=~/.cargo/bin -path+=($NPM_CONFIG_PREFIX/bin) - ## Completion autoload -Uz compinit [ -d "$XDG_CACHE_HOME"/zsh ] || mkdir -p "$XDG_CACHE_HOME"/zsh compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-$ZSH_VERSION -# Terminal emulator specifics -if [ $TERM = foot ]; then - # Enable spawning of new terminal instances in the current working directory - function osc7-pwd() { - emulate -L zsh # also sets localoptions for us - setopt extendedglob - local LC_ALL=C - printf '\e]7;file://%s%s\e\' $HOST ${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}} - } - - function chpwd-osc7-pwd() { - (( ZSH_SUBSHELL )) || osc7-pwd - } - add-zsh-hook -Uz chpwd chpwd-osc7-pwd +# Environment-specifics +if [ -n "$MYNIX_DEV" ]; then + source "$ZDOTDIR/zshrc-dev.sh" +fi +if [ -n "$MYNIX_GRAPHICAL" ]; then + source "$ZDOTDIR/zshrc-graphical.sh" fi diff --git a/user/zsh/zshrc-dev.sh b/user/zsh/zshrc-dev.sh new file mode 100644 index 0000000..484007d --- /dev/null +++ b/user/zsh/zshrc-dev.sh @@ -0,0 +1,11 @@ +# This file is sourced by .zshrc if parts/dev.nix was imported. + +## Aliases +alias code='codium' +alias tokei='tokei -s code -n commas' + +## Environment variables +export NPM_CONFIG_PREFIX="$HOME/.local/npm" + +path+=~/.cargo/bin +path+=($NPM_CONFIG_PREFIX/bin) diff --git a/user/zsh/zshrc-graphical.sh b/user/zsh/zshrc-graphical.sh new file mode 100644 index 0000000..d60c15a --- /dev/null +++ b/user/zsh/zshrc-graphical.sh @@ -0,0 +1,16 @@ +# This file is sourced by .zshrc if parts/graphical.nix was imported. + +if [ $TERM = foot ]; then + # Enable spawning of new terminal instances in the current working directory + function osc7-pwd() { + emulate -L zsh # also sets localoptions for us + setopt extendedglob + local LC_ALL=C + printf '\e]7;file://%s%s\e\' $HOST ${PWD//(#m)([^@-Za-z&-;_~])/%${(l:2::0:)$(([##16]#MATCH))}} + } + + function chpwd-osc7-pwd() { + (( ZSH_SUBSHELL )) || osc7-pwd + } + add-zsh-hook -Uz chpwd chpwd-osc7-pwd +fi |