From 6b7825f7b84b29d447e405e3d66da04188a23c6b Mon Sep 17 00:00:00 2001 From: Steffen Rademacker Date: Thu, 13 May 2021 18:25:21 +0200 Subject: [PATCH] Simpler zsh config, using zsh-utils --- zsh/aliases | 67 ++++++++++++++++++++------------------------------- zsh/exports | 59 ++++++++++++++------------------------------- zsh/functions | 8 ++---- zsh/zshrc | 43 +++++++++------------------------ 4 files changed, 58 insertions(+), 119 deletions(-) diff --git a/zsh/aliases b/zsh/aliases index fb8434a6..62db79de 100644 --- a/zsh/aliases +++ b/zsh/aliases @@ -1,56 +1,41 @@ -# Make aliases and other stuff work in sudo -alias sudo='sudo ' -alias vim=$EDITOR -alias vi=$EDITOR -alias v=$EDITOR -alias vimdiff='$EDITOR -d' -alias vdiff='$EDITOR -d' -alias vd='$EDITOR -d' -alias ..='cd ..' alias ...='cd ../..' -alias q='exit' - -# mutt -alias mutt='neomutt' -alias m='neomutt' +alias ..='cd ..' alias O="cd ~ && mbsync -a && mu index" - -# Gitty gitgit +alias anigif='convert -delay 12 -loop 0 *.jpg animated.gif' +alias brewup='brew update && brew upgrade && brew cu -a -f -y && brew cleanup' +alias dnsflush='sudo dscacheutil -flushcache' +alias dnsmasqfix='sudo brew services stop dnsmasq && sudo mkdir /usr/local/etc/dnsmasq.d && sudo brew services start dnsmasq' alias g="git" alias gf="git-flow" -alias gs="git status" alias ggpl='git pull origin $(current_branch)' -alias ggps='git push origin $(current_branch)' alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' -alias gsmu='git submodule init && git submodule update' -alias gsmuu='git submodule foreach git pull origin master' +alias ggps='git push origin $(current_branch)' alias gmo='$EDITOR $(git ls-files -m)' +alias gs="git status" alias lg='lazygit' - -# tmux and others +alias lock="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" +alias ls='exa -la' +alias m='neomutt' +alias mutt='neomutt' +alias nb="npm run build" +alias npmre='rm -f package-lock.json && rm -rf node_modules && npm install' +alias ns="npm start" +alias q='exit' +alias sudo='sudo ' alias t='tmux -u -2' alias ta='tmux -u attach' -alias ls='exa -la' - -# all in one homebrew, gem update commands -alias brewup='brew update && brew upgrade && brew cu -a -f -y && brew cleanup' alias upall='brewup && npm-check -gu' +alias v=$EDITOR +alias vd='$EDITOR -d' +alias vdiff='$EDITOR -d' +alias vi=$EDITOR +alias vim=$EDITOR +alias vimdiff='$EDITOR -d' +alias woffwoff='glyphhanger --subset="*.otf" --formats=woff-zopfli,woff2' +alias yp='yarn lint && yarn production' +alias yre='rm -f yarn.lock && rm -rf node_modules && yarn' +alias ys='yarn develop' # temp fix for dnsmasq-bootup/unifi-java fuckup -alias dnsmasqfix='sudo brew services stop dnsmasq && sudo mkdir /usr/local/etc/dnsmasq.d && sudo brew services start dnsmasq' alias unififix='sudo ln -s /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk /Applications/UniFi.app/Contents/PlugIns/adoptopenjdk-8.jdk && sudo v /Applications/UniFi.app/Contents/Info.plist' # THEN: JVMRuntime adoptopenjdk-8.jdk - -# other often used stuff, mostly node/npm -alias ns="npm start" -alias nb="npm run build" -alias npmre='rm -f package-lock.json && rm -rf node_modules && npm install' -alias ys='yarn develop' -alias yp='yarn lint && yarn production' -alias yre='rm -f yarn.lock && rm -rf node_modules && yarn' - -# random usefull stuff -alias dnsflush='sudo dscacheutil -flushcache' -alias lock="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" -alias anigif='convert -delay 12 -loop 0 *.jpg animated.gif' -alias woffwoff='glyphhanger --subset="*.otf" --formats=woff-zopfli,woff2' diff --git a/zsh/exports b/zsh/exports index 5cca22af..f60b93b3 100644 --- a/zsh/exports +++ b/zsh/exports @@ -1,52 +1,29 @@ -# term, for mutt and vim -export TERM=xterm-256color - -# language -export LC_ALL=en_US.UTF-8 -export LANG=en_US.UTF-8 - -# nice dircolors for ls export CLICOLOR=1 +export COPYFILE_DISABLE=true +export COPY_EXTENDED_ATTRIBUTES_DISABLE=true +export DISABLE_AUTO_TITLE=true +export EDITOR="/usr/local/bin/nvim" +export GREP_COLOR='1;32' +export GREP_OPTIONS='--color=auto' +export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 +export LC_CTYPE=$LANG +export LESS="-R" export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx - -# shell -export SHELL=/usr/local/bin/zsh - -# brew CASK -export HOMEBREW_CASK_OPTS="--appdir=/Applications" - -# paths +export MANPATH=/usr/local/share/man:$MANPATH +export PAGER="less" export PATH=/usr/local/bin:$PATH -export PATH=/usr/local/sbin:$PATH export PATH=/usr/local/opt/curl/bin:$PATH -export PATH=/usr/local/opt/ruby/bin:$PATH -export PATH=/usr/local/lib/ruby/gems/2.7.0/bin:$PATH -export PATH=/usr/local/opt/php@7.3/bin:$PATH -export PATH=/usr/local/opt/php@7.3/sbin:$PATH - -# manpath -export MANPATH=/usr/local/share/man:$MANPATH - -# disable stupid ._ and dsstore files -export COPY_EXTENDED_ATTRIBUTES_DISABLE=true -export COPYFILE_DISABLE=true - -# editor -export EDITOR="/usr/local/bin/nvim" +export PATH=/usr/local/sbin:$PATH +export SHELL=/usr/local/bin/zsh +export TERM=xterm-256color export VISUAL="/usr/local/bin/nvim" -# disable auto titling fixes tmux window -export DISABLE_AUTO_TITLE=true - -# grep / ripgrep -export GREP_OPTIONS='--color=auto' -export GREP_COLOR='1;32' +# ripgrep export RIPGREP_CONFIG_PATH="$HOME/dotfiles/ripgreprc" -# pager -export PAGER="less" -export LESS="-R" -export LC_CTYPE=$LANG +# brew +export HOMEBREW_CASK_OPTS="--appdir=/Applications" # nnn export NNN_OPTS='deHR' diff --git a/zsh/functions b/zsh/functions index 79c63e53..cb4d53b7 100644 --- a/zsh/functions +++ b/zsh/functions @@ -1,6 +1,4 @@ -# TERMINAL INTEGRATIONS # -######################### - +# TERMINAL INTEGRATIONS l () { if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then echo "nnn is already running" @@ -38,9 +36,7 @@ fancy-ctrl-z () { fi } -# CUSTOM FUNCTIONS # -#################### - +# CUSTOM FUNCTIONS wttr () { if [[ -n "$1" ]] then diff --git a/zsh/zshrc b/zsh/zshrc index 361e7520..fdfa59e2 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -4,40 +4,27 @@ for file in ~/dotfiles/zsh/{antigen.zsh,exports,aliases,functions}; do done unset file -# history settings -if [ -z $HISTFILE ]; then - HISTFILE=$HOME/.zsh_history -fi -HISTSIZE=1000000 -SAVEHIST=1000000 +# plugins +antigen use belak/zsh-utils +antigen bundle zsh-users/zsh-syntax-highlighting +antigen bundle zsh-users/zsh-completions +antigen bundle zsh-users/zsh-autosuggestions +antigen bundle history +antigen bundle completion +antigen apply -setopt append_history -setopt extended_history -setopt hist_expire_dups_first -setopt hist_ignore_dups -setopt hist_save_no_dups -setopt hist_ignore_all_dups -setopt hist_ignore_space -setopt hist_verify -setopt inc_append_history -setopt share_history -setopt long_list_jobs +# history +setopt SHARE_HISTORY +unsetopt HIST_BEEP # a nice prompt, install it via npm to make this work autoload -U promptinit; promptinit prompt pure # completions -autoload -U compinit && compinit -C -autoload bashcompinit && bashcompinit +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' compdef g=git compdef gf=git-flow -zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' -unsetopt flowcontrol -unsetopt menu_complete -setopt auto_menu -setopt complete_in_word -setopt always_to_end # easy vim/terminal switch zle -N fancy-ctrl-z @@ -47,12 +34,6 @@ bindkey '^Z' fancy-ctrl-z autoload -U url-quote-magic zle -N self-insert url-quote-magic -# plugins -antigen bundle zsh-users/zsh-syntax-highlighting -antigen bundle zsh-users/zsh-completions -antigen bundle zsh-users/zsh-autosuggestions -antigen apply - # other tools init [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh eval "$(jump shell)"