aboutsummaryrefslogtreecommitdiff
path: root/zsh/zshrc
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2026-08-01 17:29:55 +0200
committerThomas Schmucker <ts@its1.de>2026-08-01 17:29:55 +0200
commitb61387adc936dc51f1d9e84136aa9972ea8480e7 (patch)
tree9e613f01d2e381855bfdc452596d83f89e37e25e /zsh/zshrc
parent428beb1c921ce09bf269560ee67afeb628b5c247 (diff)
downloaddotfiles-b61387adc936dc51f1d9e84136aa9972ea8480e7.tar.gz
dotfiles-b61387adc936dc51f1d9e84136aa9972ea8480e7.tar.bz2
dotfiles-b61387adc936dc51f1d9e84136aa9972ea8480e7.zip
zsh: Schreibweise für Funktionen und 'source' vereinheitlicht
Diffstat (limited to 'zsh/zshrc')
-rw-r--r--zsh/zshrc27
1 files changed, 16 insertions, 11 deletions
diff --git a/zsh/zshrc b/zsh/zshrc
index 7d8d675..fd04552 100644
--- a/zsh/zshrc
+++ b/zsh/zshrc
@@ -1,7 +1,7 @@
1# vim: filetype=zsh 1# vim: filetype=zsh
2 2
3# Hooks 3# Hooks
4function chpwd() { 4chpwd() {
5 if [[ -n "$VIRTUAL_ENV" && -f "$VIRTUAL_ENV/bin/activate" ]]; then 5 if [[ -n "$VIRTUAL_ENV" && -f "$VIRTUAL_ENV/bin/activate" ]]; then
6 local venv_dir="${VIRTUAL_ENV:h}" 6 local venv_dir="${VIRTUAL_ENV:h}"
7 if [[ "$PWD" != "$venv_dir"* ]] && (( $+functions[deactivate] )); then 7 if [[ "$PWD" != "$venv_dir"* ]] && (( $+functions[deactivate] )); then
@@ -11,15 +11,17 @@ function chpwd() {
11 11
12 for v in .venv venv .env; do 12 for v in .venv venv .env; do
13 if [[ -f "$v/bin/activate" ]]; then 13 if [[ -f "$v/bin/activate" ]]; then
14 source "$v/bin/activate" 14 . "$v/bin/activate"
15 break 15 break
16 fi 16 fi
17 done 17 done
18} 18}
19 19
20# Funktionen 20# Funktionen
21function source_file() { 21source_if_exists() {
22 [[ ! -r "$1" ]] || source "$1" 22 if [[ -r "$1" ]]; then
23 . "$1"
24 fi
23} 25}
24 26
25# Optionen 27# Optionen
@@ -31,16 +33,16 @@ setopt SHARE_HISTORY
31setopt HIST_IGNORE_ALL_DUPS 33setopt HIST_IGNORE_ALL_DUPS
32setopt HIST_IGNORE_SPACE 34setopt HIST_IGNORE_SPACE
33 35
34source_file "$HOME/.opam/opam-init/init.zsh" 36source_if_exists "$HOME/.opam/opam-init/init.zsh"
35 37
36case "$OSTYPE" in 38case "$OSTYPE" in
37 darwin*) 39 darwin*)
38 source_file "/opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 40 source_if_exists "/opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
39 source_file "/opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh" 41 source_if_exists "/opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
40 ;; 42 ;;
41 freebsd*) 43 freebsd*)
42 source_file "/usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 44 source_if_exists "/usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
43 source_file "/usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh" 45 source_if_exists "/usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
44 ;; 46 ;;
45esac 47esac
46 48
@@ -86,12 +88,13 @@ nvim-update() {
86} 88}
87 89
88# Command completion 90# Command completion
89autoload -U compinit; compinit 91autoload -U compinit
92compinit
90_comp_options+=(globdots) # With hidden files 93_comp_options+=(globdots) # With hidden files
91 94
92# ... Angular CLI 95# ... Angular CLI
93if (( $+commands[ng] )); then 96if (( $+commands[ng] )); then
94 source <(ng completion script) 97 . <(ng completion script)
95fi 98fi
96 99
97zstyle ':completion:*' completer _extensions _complete _approximate 100zstyle ':completion:*' completer _extensions _complete _approximate
@@ -119,3 +122,5 @@ zstyle ':vcs_info:*' check-for-changes true
119zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%a%u%c%F{3}|%F{1}%a%F{5}]%f' 122zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%a%u%c%F{3}|%F{1}%a%F{5}]%f'
120zstyle ':vcs_info:*' formats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%u%c%F{5}]%f' 123zstyle ':vcs_info:*' formats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%u%c%F{5}]%f'
121zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' 124zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
125
126unfunction source_if_exists