Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F56333789
.zshrc
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
.zshrc
View Options
# -------------------------------------------------------------
# Zsh configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Wynter
# Description: ZSH configuration for remote servers
# License: Trivial work, not eligible to copyright
# Source file: roles/core/userland-home/files/dereckson/.zshrc
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
# -------------------------------------------------------------
# -------------------------------------------------------------
# Table of contents
# -------------------------------------------------------------
#
# :: Completions
# :: History
# :: Prompt
# :: Background jobs
# :: Compatibility with csh
# :: Environment
# :: SSH
# :: Keys bindings
# :: External modules
# :: VCS
# :: Rust
# :: Aliases for salt-wrapper
# :: Misc aliases
#
# -------------------------------------------------------------
# -------------------------------------------------------------
# Completions
#
# This section has been prepared with compinstall
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' completions 1
zstyle ':completion:*' glob 1
zstyle ':completion:*' matcher-list ''
zstyle ':completion:*' max-errors 3
zstyle ':completion:*' substitute 1
autoload -Uz compinit
compinit
setopt extendedglob
setopt no_nomatch
# -------------------------------------------------------------
# History
#
# https://blog.callstack.io/supercharge-your-terminal-with-zsh-8b369d689770
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HISTFILE=~/.histfile
HISTSIZE=100000
SAVEHIST=$HISTSIZE
setopt appendhistory
if [[ -a /usr/local/share/zsh/wynter/zsh-histdb/sqlite-history.zsh ]]; then
source /usr/local/share/zsh/wynter/zsh-histdb/sqlite-history.zsh
autoload -Uz add-zsh-hook
else
setopt hist_ignore_all_dups
setopt hist_reduce_blanks
setopt inc_append_history # save history entries as soon as they are entered
setopt share_history # share history between different instances of the shell
fi
# -------------------------------------------------------------
# Prompt
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
prompt='%B%/%b ] '
# -------------------------------------------------------------
# Background jobs
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setopt notify
# -------------------------------------------------------------
# Compatibility with csh
#
# makecheck / https://news.ycombinator.com/item?id=4201636
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setenv () {
if [ "x$1" = "x" ] ; then
echo "$0: environment variable name required" >&2
elif [ "x$2" = "x" ] ; then
echo "$0: environment variable value required" >&2
else
export $1=$2
fi
}
unsetenv () {
if [ "x$1" = "x" ] ; then
echo "$0: environment variable name required" >&2
else
unset $1
fi
}
# -------------------------------------------------------------
# Environment
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[[ $TERM == xterm ]] && export TERM=xterm-256color
[[ $TERM == screen ]] && export TERM=screen-256color
[[ $TERM == tmux ]] && export TERM=tmux-256color
export BLOCKSIZE=K
export EDITOR=nano
export PAGER=less
export LESS=eiMqXR
export LC_ALL=en_US.UTF-8
# -------------------------------------------------------------
# SSH
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [[ -a $HOME/bin/ssh-agent-session ]]; then
source $HOME/bin/ssh-agent-session
fi
# -------------------------------------------------------------
# Keys bindings
#
# http://zshwiki.org/home/zle/bindkeys
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bindkey -e
autoload zkbd
source $HOME/.zkbd/$TERM
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
export WORDCHARS='*?_[]~=&;!#$%^(){}'
[[ -n "$key[Home]" ]] && bindkey -- "$key[Home]" beginning-of-line
[[ -n "$key[End]" ]] && bindkey -- "$key[End]" end-of-line
[[ -n "$key[Insert]" ]] && bindkey -- "$key[Insert]" overwrite-mode
[[ -n "$key[Backspace]" ]] && bindkey -- "$key[Backspace]" backward-delete-char
[[ -n "$key[Delete]" ]] && bindkey -- "$key[Delete]" delete-char
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
[[ -n "$key[Left]" ]] && bindkey -- "$key[Left]" backward-char
[[ -n "$key[Right]" ]] && bindkey -- "$key[Right]" forward-char
# Ctrl modifiers is tested but not used?
# Probably best to take $key[Left] and $key[Right] and insert 1;5
bindkey '^[[1;5C' emacs-forward-word
bindkey '^[[1;5D' emacs-backward-word
# -------------------------------------------------------------
# External modules
#
# :: pm
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [[ -a ~/.pm/pm.zsh ]]; then
source ~/.pm/pm.zsh
plugins=(pm)
fi
# -------------------------------------------------------------
# VCS
#
# :: vcs_info prompt
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats \
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn
vcs_info_wrapper() {
vcs_info
if [ -n "$vcs_info_msg_0_" ]; then
echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
fi
}
RPROMPT=$'$(vcs_info_wrapper)'
# -------------------------------------------------------------
# Rust
#
# Use rustup version of cargo
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [[ -d $HOME/.cargo/bin ]]; then
setenv PATH $HOME/.cargo/bin:$PATH
fi
# -------------------------------------------------------------
# Aliases for salt-wrapper
#
# https://docs.nasqueron.org/salt-wrapper/admin.html#shell-aliases
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if [[ -a /usr/local/bin/salt-wrapper ]]; then
alias salt='salt-wrapper salt'
alias salt-call='salt-wrapper salt-call'
alias salt-cloud='salt-wrapper salt-cloud'
alias salt-key='salt-wrapper salt-key'
alias salt-run='salt-wrapper salt-run'
alias salt-ssh='salt-wrapper salt-ssh'
fi
# -------------------------------------------------------------
# Go
#
# Switch to pm go if not installed
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if command -v go > /dev/null
then
export GOPATH="$HOME/dev/go"
elif [[ -a ~/.pm/pm.zsh ]]
then
alias go='pm go'
fi
# -------------------------------------------------------------
# External software integration
#
# :: starship prompt
# :: z cd alternative
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
command -v starship > /dev/null && eval "$(starship init zsh)"
command -v zoxide > /dev/null && eval "$(zoxide init zsh)"
# -------------------------------------------------------------
# Vault
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
export VAULT_ADDR='https://172.27.27.7:8200'
# -------------------------------------------------------------
# Colorize output with grc
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if command -v grc >/dev/null 2>&1; then
alias mysql="mysql --pager='grcat /usr/local/share/grc/conf.mysql | less -RSFXin'"
alias ping='grc ping'
alias ping6='grc ping6'
fi
# -------------------------------------------------------------
# Misc aliases
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
alias cd..='cd ..'
alias cd...='cd ../..'
alias cd....='cd ../../..'
alias h=history
alias n=nano
alias tclsh='rlwrap tclsh8.6'
alias psysh='rlwrap psysh'
alias weather="curl http://v2.wttr.in/Brussels"
if [[ -a ~/.zshrc-misc-aliases ]]; then
source ~/.zshrc-misc-aliases
fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 7, 03:42 (3 h, 49 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3979953
Default Alt Text
.zshrc (8 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment