aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zsh/zprofile10
-rw-r--r--zsh/zshrc27
2 files changed, 24 insertions, 13 deletions
diff --git a/zsh/zprofile b/zsh/zprofile
index cfb0fbb..7fed3a7 100644
--- a/zsh/zprofile
+++ b/zsh/zprofile
@@ -1,9 +1,13 @@
1# vim: filetype=zsh 1# vim: filetype=zsh
2 2
3[[ -d "${HISTFILE:h}" ]] || mkdir -p "${HISTFILE:h}" 3if [[ ! -d "${HISTFILE:h}" ]]; then
4 mkdir -p "${HISTFILE:h}"
5fi
4 6
5add_path() { 7add_path() {
6 [[ -d "$1" ]] && path=("$1" $path) 8 if [[ -d "$1" ]]; then
9 path=("$1" $path)
10 fi
7} 11}
8 12
9set_include_lib_path() { 13set_include_lib_path() {
@@ -57,3 +61,5 @@ if [[ -x /usr/local/bin/musicpd ]] && ! pgrep "musicpd" > /dev/null; then
57 /usr/local/bin/musicpd 61 /usr/local/bin/musicpd
58fi 62fi
59 63
64unfunction add_path
65unfunction set_include_lib_path
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