83 lines
2.2 KiB
Bash
83 lines
2.2 KiB
Bash
autoload -Uz promptinit && promptinit
|
|
autoload -Uz compinit && compinit
|
|
autoload -Uz colors && colors
|
|
zmodload -i zsh/complist
|
|
|
|
zstyle ':completion:*' accept-exact "*(N)"
|
|
zstyle ':completion:*' use-cache on
|
|
zstyle ':completion:*' cache-path ~/.zsh/compcache
|
|
|
|
bindkey -v
|
|
bindkey '^?' backward-delete-char
|
|
bindkey '^R' history-incremental-search-backward
|
|
|
|
# PROMPT
|
|
function parse_git_dirty() {
|
|
STATUS=$(command git status --porcelain --untracked-files=no | tail -n1)
|
|
if [[ -n $STATUS ]]; then
|
|
echo "%{$fg[red]%}✗"
|
|
else
|
|
echo "%{$fg[green]%}✔"
|
|
fi
|
|
}
|
|
|
|
function git_prompt() {
|
|
isgit=$(command git rev-parse --is-inside-work-tree 2>/dev/null)
|
|
if [[ $isgit == "true" ]]; then
|
|
ref=$(command git symbolic-ref HEAD -q --short)
|
|
echo "%{$fg[cyan]%}$ref $(parse_git_dirty)%{$reset_color%}"
|
|
fi
|
|
}
|
|
|
|
setopt promptsubst
|
|
GIT='$(git_prompt)'
|
|
PROMPT="%(?, ,%{$fg[red]%}FAIL%{$reset_color%}
|
|
)
|
|
%{$fg[green]%}[%*]%{$reset_color%} %m %{$fg[yellow]%}%~%{$reset_color%} $GIT
|
|
%_ $ "
|
|
|
|
# Autocomplete menu
|
|
bindkey -M menuselect '^o' accept-and-infer-next-history
|
|
zstyle ':completion:*:*:*:*:*' menu select
|
|
|
|
# Case insensitive autocomplete
|
|
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
|
|
zstyle ':completion:*' list-colors ''
|
|
zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories
|
|
|
|
expand-or-complete-with-dots() {
|
|
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
|
|
print -Pn "%{%F{red}......%f%}"
|
|
[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
|
|
zle expand-or-complete
|
|
zle redisplay
|
|
}
|
|
zle -N expand-or-complete-with-dots
|
|
bindkey '^I' expand-or-complete-with-dots
|
|
|
|
HISTFILE=~/.zsh_history
|
|
HISTSIZE=10000
|
|
SAVEHIST=10000
|
|
setopt extendedglob
|
|
|
|
export EDITOR='vim'
|
|
|
|
alias pacman='sudo pacman --color always'
|
|
alias ls='ls --color=auto'
|
|
alias iptables='sudo iptables'
|
|
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles.git --work-tree=$HOME'
|
|
|
|
# PAZI
|
|
if command -v pazi &>/dev/null; then
|
|
eval "$(pazi init zsh)"
|
|
fi
|
|
|
|
# Ensure our build toolchain is in the path!
|
|
export PATH="/opt/gcc-arm-none-eabi-7-2018-q2-update/bin:$PATH"
|
|
|
|
# Add gems to path
|
|
export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH"
|
|
|
|
# Enable ccache
|
|
export PATH="/usr/lib/ccache/bin/:$PATH"
|