summaryrefslogtreecommitdiff
path: root/config/zshrc
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-02-15 16:31:56 +0100
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-02-15 16:47:43 +0100
commit3b2a78935fd6550521f719a10e5b0fceb1ddb350 (patch)
tree7c50801d6bb5b7abba3df6352ed43df454a4dbcb /config/zshrc
Not really but, First commit!
Diffstat (limited to 'config/zshrc')
-rw-r--r--config/zshrc/.zshrc97
1 files changed, 97 insertions, 0 deletions
diff --git a/config/zshrc/.zshrc b/config/zshrc/.zshrc
new file mode 100644
index 0000000..7ce2e64
--- /dev/null
+++ b/config/zshrc/.zshrc
@@ -0,0 +1,97 @@
+#!/bin/zsh
+
+export PATH="$HOME/.local/bin:$PATH"
+export PATH="$HOME/bin:$PATH"
+export PATH="$HOME/go/bin:$PATH"
+
+test -f ~/.config/zsh/variables.zsh && source ~/.config/zsh/variables.zsh
+
+if [ ! $(pgrep Xorg) ] && [ "tty1" = "$(basename $(tty))" ]
+then
+ clear
+ test -f ~/.config/zsh/startup.sh && . ~/.config/zsh/startup.sh
+ startx 2&> /dev/null
+ exit
+fi
+
+autoload -U select-word-style
+select-word-style bash
+autoload -z edit-command-line
+zle -N edit-command-line
+zstyle :compinstall filename '/home/aluc/.zshrc'
+autoload -Uz compinit
+compinit
+
+autoload -Uz surround
+zle -N delete-surround surround
+zle -N add-surround surround
+zle -N change-surround surround
+bindkey -v
+bindkey -a cs change-surround
+bindkey -a ds delete-surround
+bindkey -a ys add-surround
+bindkey -M visual S add-surround
+bindkey "^A" beginning-of-line
+bindkey "^E" end-of-line
+# necessary for completeinword
+bindkey '^I' expand-or-complete-prefix
+bindkey "^K" kill-line
+bindkey "^P" up-line-or-history
+bindkey "^N" down-line-or-history
+bindkey "^V" quoted-insert
+bindkey "^Xa" _expand_alias
+bindkey "^Xe" edit-command-line
+bindkey "^[." insert-last-word
+bindkey "^['" quote-line
+
+# pacman synced rehash
+zshcache_time="$(date +%s%N)"
+autoload -Uz add-zsh-hook
+rehash_precmd() {
+ if [[ -a /var/cache/zsh/pacman ]]; then
+ local paccache_time="$(date -r /var/cache/zsh/pacman +%s%N)"
+ if (( zshcache_time < paccache_time )); then
+ rehash
+ zshcache_time="$paccache_time"
+ fi
+ fi
+}
+add-zsh-hook -Uz precmd rehash_precmd
+
+setopt prompt_subst
+parse_git_branch() {
+ git symbolic-ref --short HEAD 2> /dev/null || git rev-parse --short HEAD 2> /dev/null
+}
+parse_git_status() {
+ git status --short 2> /dev/null | head -n1 | awk '{print $1 " "}'
+}
+PS1=' %B%(#.%F{1}.%F{13})[%n%b%f@%B%F{6}%m]%b%f %3~ '
+RPROMPT='%F{red}$(parse_git_status)%f%F{green}$(parse_git_branch)%f%(?.. %?)'
+
+# Options
+setopt correct
+#I am scared of "no matches found"
+setopt nonomatch
+setopt autocd
+setopt completeinword
+#regexlike matching
+setopt extendedglob
+setopt histignoredups
+setopt histreduceblanks
+#enable comments on commandline
+setopt interactive_comments
+#say status of bg jobs immediately
+setopt notify
+
+for f in \
+ /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh \
+ /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh \
+ ~/.config/zsh/functions.zsh \
+ ~/.config/zsh/aliases.zsh
+do
+ test -f $f && source $f
+done
+
+HISTFILE=~/.config/zsh/histfile
+HISTSIZE=100000
+SAVEHIST=100000