152 lines
5.1 KiB
Plaintext
152 lines
5.1 KiB
Plaintext
### =============== Git prompt ================ ###
|
|
source ".zsh-git-prompt/zshrc.sh"
|
|
ZSH_THEME_GIT_PROMPT_BRANCH="%{\x1b[3m%}%{$fg[cyan]%}"
|
|
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[green]%}%{¤%G%}"
|
|
ZSH_THEME_GIT_PROMPT_CONFLICTS="%{$fg[blue]%}%{x%G%}"
|
|
ZSH_THEME_GIT_PROMPT_CHANGED="%{$fg[red]%}%{+%G%}"
|
|
ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg[red]%}%{↓%G%}"
|
|
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%}%{↑%G%}"
|
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="$fg[red]%}%{…%G%}"
|
|
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}%{✔%G%}"
|
|
### =============== Git prompt ================ ###
|
|
|
|
## Enable completion
|
|
zstyle ':completion:*' completer _complete _ignored
|
|
zstyle ':completion:*' menu select
|
|
setopt completealiases
|
|
autoload -Uz compinit
|
|
compinit
|
|
|
|
## Enable ANSI colors
|
|
autoload -U color
|
|
|
|
## Set various options
|
|
setopt appendhistory nomatch notify
|
|
unsetopt autocd beep extendedglob
|
|
bindkey -e
|
|
|
|
## History
|
|
setopt HIST_IGNORE_DUPS
|
|
HISTFILE=~/.histfile
|
|
HISTSIZE=100000
|
|
SAVEHIST=100000
|
|
|
|
## Automatically fix terminal settings
|
|
ttyctl -f
|
|
|
|
## Set a nice prompt
|
|
PROMPT='%F{red}[%F{blue}%*%F{red}]%f %F{yellow}bosman%f %F{magenta}[%f%B%F{magenta}%1~%f%b%F{magenta}]%f %(!.%F{196}.%F{46})≫ %f$(git_super_status)%F{28} %f '
|
|
|
|
## Set a nice remote prompt
|
|
YELLOW="\[\033[38;5;3m\]"
|
|
BLUE="\[\033[38;5;4m\]"
|
|
ORANGE="\[\033[38;5;202m\]"
|
|
MAGENTA="\[\033[38;5;6m\]"
|
|
GREEN="\[\033[38;5;41m\]"
|
|
NOCOLOR="\[\033[0m\]"
|
|
BOL_FANCYPROMPT="${ORANGE}[${BLUE}\t${ORANGE}] ${YELLOW}\h ${MAGENTA}\W ${GREEN}≫${NOCOLOR} "
|
|
export BOL_FANCYPROMPT
|
|
|
|
## Enable colors
|
|
LESS='-R'
|
|
LESSOPEN='|~/.lessfilter %s'
|
|
|
|
## Setup editor and pager variables
|
|
PAGER="less"
|
|
EDITOR="vim"
|
|
VISUAL="${EDITOR}"
|
|
TERM="xterm-256color"
|
|
export PAGER EDITOR VISUAL TERM
|
|
|
|
## Setup the CDPATH with interesting directories
|
|
typeset -U path cdpath fpath
|
|
cdpath=(
|
|
.
|
|
~/vagrant
|
|
)
|
|
|
|
|
|
alias ls='ls --color=auto'
|
|
|
|
## Add pastebin support
|
|
function Paste { curl -s -d "content='$(cat ${1})'&expire=6h" -o/dev/null -w "%{redirect_url}\n" http://go-paste.service.local:8080/; }
|
|
|
|
# create a zkbd compatible hash;
|
|
# to add other keys to this hash, see: man 5 terminfo
|
|
typeset -A key
|
|
|
|
key[Home]=${terminfo[khome]}
|
|
key[End]=${terminfo[kend]}
|
|
key[Insert]=${terminfo[kich1]}
|
|
key[Delete]=${terminfo[kdch1]}
|
|
key[Up]=${terminfo[kcuu1]}
|
|
key[Down]=${terminfo[kcud1]}
|
|
key[Left]=${terminfo[kcub1]}
|
|
key[Right]=${terminfo[kcuf1]}
|
|
key[PageUp]=${terminfo[kpp]}
|
|
key[PageDown]=${terminfo[knp]}
|
|
|
|
# setup key accordingly
|
|
[[ -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[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
|
|
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
|
|
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
|
|
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
|
|
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
|
|
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
|
|
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
|
|
|
|
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
|
function zle-line-init () {
|
|
printf '%s' "${terminfo[smkx]}"
|
|
}
|
|
function zle-line-finish () {
|
|
printf '%s' "${terminfo[rmkx]}"
|
|
}
|
|
zle -N zle-line-init
|
|
zle -N zle-line-finish
|
|
fi
|
|
|
|
# ssh, scp, ping, host
|
|
zstyle ':completion:*:scp:*' tag-order \
|
|
'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'
|
|
zstyle ':completion:*:scp:*' group-order \
|
|
users files all-files hosts-domain hosts-host hosts-ipaddr
|
|
zstyle ':completion:*:ssh:*' tag-order \
|
|
users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'
|
|
zstyle ':completion:*:ssh:*' group-order \
|
|
hosts-domain hosts-host users hosts-ipaddr
|
|
|
|
zstyle ':completion:*:(ssh|scp):*:hosts-host' ignored-patterns \
|
|
'*.*' loopback localhost
|
|
zstyle ':completion:*:(ssh|scp):*:hosts-domain' ignored-patterns \
|
|
'<->.<->.<->.<->' '^*.*' '*@*'
|
|
zstyle ':completion:*:(ssh|scp):*:hosts-ipaddr' ignored-patterns \
|
|
'^<->.<->.<->.<->' '127.0.0.<->'
|
|
zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns \
|
|
adm bin daemon halt lp named shutdown sync
|
|
|
|
zstyle -e ':completion:*:(ssh|scp):*' hosts 'reply=(
|
|
${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \
|
|
/dev/null)"}%%[# ]*}//,/ }
|
|
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
|
|
${=${${${${(@M)${(f)"$(<~/.ssh/config)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
|
)'
|
|
bindkey "^[OA" history-beginning-search-backward
|
|
bindkey "^[OB" history-beginning-search-forward
|
|
for f in ~/.zsh.d/*.zsh; do
|
|
source "$f"
|
|
done
|
|
|
|
# The next line updates PATH for the Google Cloud SDK.
|
|
if [ -f /Users/snarbutas/google-cloud-sdk/path.zsh.inc ]; then
|
|
source '/Users/snarbutas/google-cloud-sdk/path.zsh.inc'
|
|
fi
|
|
|
|
# The next line enables shell command completion for gcloud.
|
|
#if [ -f /Users/snarbutas/google-cloud-sdk/completion.zsh.inc ]; then
|
|
# source '/Users/snarbutas/google-cloud-sdk/completion.zsh.inc'
|
|
#fi
|