zsh: zap based config
This commit is contained in:
parent
db53671f68
commit
e44c73f1c7
@ -1,7 +0,0 @@
|
||||
Directory for plugins. Checkout here
|
||||
|
||||
1. zsh-autosuggestions (https://github.com/zsh-users/zsh-autosuggestions)
|
||||
2. zsh-syntax-highlighting (https://github.com/zsh-users/zsh-syntax-highlighting)
|
||||
3. https://github.com/jeffreytse/zsh-vi-mode
|
||||
|
||||
or install then with package manager in /usr/share/zsh/plugins/ and symlink.
|
122
shell/.zshrc
122
shell/.zshrc
@ -1,108 +1,32 @@
|
||||
# History.
|
||||
# Install zap:
|
||||
# % cd ~/.local/share
|
||||
# % git clone https://github.com/zap-zsh/zap.git --branch=release-v1
|
||||
|
||||
HISTFILE=${ZDOTDIR:-~}/.zsh_history
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
setopt append_history
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_find_no_dups
|
||||
setopt hist_ignore_all_dups
|
||||
setopt hist_ignore_space
|
||||
setopt hist_reduce_blanks
|
||||
setopt inc_append_history
|
||||
setopt share_history
|
||||
export FZF_DEFAULT_OPTS='--color=bw,hl:green,hl+:green'
|
||||
zstyle ':fzf-tab:*' fzf-flags $FZF_DEFAULT_OPTS
|
||||
|
||||
[ -f "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh" ] && source "${XDG_DATA_HOME:-$HOME/.local/share}/zap/zap.zsh"
|
||||
plug "zap-zsh/supercharge"
|
||||
plug "zap-zsh/exa"
|
||||
plug "zap-zsh/vim"
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
|
||||
plug "Aloxaf/fzf-tab"
|
||||
plug "zap-zsh/fzf"
|
||||
plug "zsh-users/zsh-autosuggestions"
|
||||
plug "zsh-users/zsh-syntax-highlighting"
|
||||
|
||||
# Prompt.
|
||||
|
||||
autoload -Uz vcs_info
|
||||
precmd () { vcs_info }
|
||||
setopt prompt_subst
|
||||
zstyle ':vcs_info:git:*' formats '%F{magenta}(%b)%r%f '
|
||||
zstyle ':vcs_info:git:*' check-for-changes true
|
||||
zstyle ':vcs_info:git:*' formats '%F{green}%r%f/%F{yellow}%S%f %F{magenta}(%b)%u%c%f '
|
||||
zstyle ':vcs_info:git:*' actionformats '%F{green}%r%f/%F{yellow}%S%f %F{magenta}(%b|%a)%u%c%f '
|
||||
zstyle ':vcs_info:*' nvcsformats '%F{green}%~%f%b '
|
||||
zstyle ':vcs_info:*' enable git
|
||||
PS1='%B%F{blue}%n@%m%f %F{green}%~%f%b ${vcs_info_msg_0_}%B%#%f%b '
|
||||
PS1='%B%F{blue}%n@%m%f ${vcs_info_msg_0_}%B%#%f%b '
|
||||
RPROMPT='%(?..%B%F{red}%?%f%b)'
|
||||
|
||||
# Completion.
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
||||
zstyle ':completion:*' menu select
|
||||
|
||||
# Options.
|
||||
|
||||
setopt auto_cd
|
||||
setopt extended_glob
|
||||
setopt glob_complete
|
||||
setopt interactive_comments
|
||||
setopt no_flow_control
|
||||
WORDCHARS=
|
||||
|
||||
# Terminal title.
|
||||
|
||||
autoload -Uz add-zsh-hook
|
||||
|
||||
function xterm_title_precmd () {
|
||||
print -Pn -- '\e]2;%n@%m %~\a'
|
||||
}
|
||||
|
||||
function xterm_title_preexec () {
|
||||
print -Pn -- '\e]2;%n@%m %~ %# ' && print -n -- "${(q)1}\a"
|
||||
}
|
||||
|
||||
if [[ "$TERM" == (alacritty*|gnome*|konsole*|putty*|rxvt*|screen*|tmux*|xterm*) ]]; then
|
||||
add-zsh-hook -Uz precmd xterm_title_precmd
|
||||
add-zsh-hook -Uz preexec xterm_title_preexec
|
||||
fi
|
||||
|
||||
# Vterm directory.
|
||||
|
||||
function vterm_printf () {
|
||||
if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ] ); then
|
||||
# Tell tmux to pass the escape sequences through
|
||||
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
|
||||
elif [ "${TERM%%-*}" = "screen" ]; then
|
||||
# GNU screen (screen, screen-256color, screen-256color-bce)
|
||||
printf "\eP\e]%s\007\e\\" "$1"
|
||||
else
|
||||
printf "\e]%s\e\\" "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
function vterm_prompt_end () {
|
||||
vterm_printf "51;A$(pwd)";
|
||||
}
|
||||
|
||||
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
|
||||
add-zsh-hook -Uz chpwd vterm_prompt_end
|
||||
fi
|
||||
|
||||
# Plugins.
|
||||
|
||||
source_if_exists() {
|
||||
[ -e "$1" ] && source "$1"
|
||||
}
|
||||
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5,underline"
|
||||
source_if_exists ~/.config/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh
|
||||
|
||||
if source_if_exists ~/.config/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh; then
|
||||
ZSH_HIGHLIGHT_STYLES[comment]=fg=cyan,bold
|
||||
fi
|
||||
|
||||
source_if_exists ~/.config/zsh/plugins/zsh-vi-mode/zsh-vi-mode.plugin.zsh
|
||||
|
||||
|
||||
# Directory stack and ls colors.
|
||||
|
||||
DIRSTACKSIZE=10
|
||||
setopt auto_pushd pushd_minus pushd_silent pushd_to_home pushd_ignore_dups
|
||||
|
||||
eval $(dircolors)
|
||||
|
||||
# Aliases.
|
||||
|
||||
alias dh='dirs -v'
|
||||
alias e='emacsclient -n'
|
||||
alias history='history -i'
|
||||
alias ls='ls --color=tty'
|
||||
|
Loading…
x
Reference in New Issue
Block a user