dotfiles/zshrc

77 lines
1.7 KiB
Bash
Raw Normal View History

2020-05-09 16:16:22 +00:00
export PATH=$HOME/go/bin:$HOME/.local/bin:$HOME/.cargo/bin:$PATH
if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
eval $(thefuck --alias)
autoload -Uz vcs_info
export EDITOR="nvim"
alias vim=nvim
alias ls='ls --color=auto'
precmd_vcs_info() {
vcs_info
}
precmd_functions+=(precmd_vcs_info)
zstyle ':vcs_info:git:*' formats '%F{245}%b %m%u%c%f '
zstyle ':vcs_info:*' enable git
setopt prompt_subst
if [ "$SSH_CONNECTION" ]; then
PROMPT_HOST="%F{yellow}[ssh] $HOST%f "
fi
export PROMPT='$PROMPT_HOST%(?..%F{red}%? )%f%20<…<%~%<<$(pretty-git-prompt) %F{117}>%f '
HISTSIZE=20000
HISTFILE=~/.zsh_history
SAVEHIST=20000
HISTDUP=erase
setopt appendhistory
setopt sharehistory
setopt incappendhistory
bindkey -v
2020-05-09 19:59:56 +00:00
bindkey '^[[H' beginning-of-line
bindkey '^[[F' end-of-line
2020-05-09 16:16:22 +00:00
bindkey '^R' history-incremental-search-backward
KEYTIMEOUT=1
function zle-keymap-select zle-line-init {
case $KEYMAP in
vicmd) print -n -- "\E]50;CursorShape=0\C-G";; # block cursor
viins|main) print -n -- "\E]50;CursorShape=1\C-G";; # line cursor
esac
zle reset-prompt
zle -R
}
function zle-line-finish {
print -n -- "\E]50;CursorShape=0\C-G" # block cursor
}
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
setopt autocd menucomplete
first-tab() {
if [[ $#BUFFER == 0 ]]; then
BUFFER="cd "
CURSOR=3
zle list-choices
else
zle expand-or-complete
fi
}
zle -N first-tab
bindkey '^I' first-tab
zstyle ':completion:*' menu select
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh