mirror of
https://github.com/rydesun/dotfiles.git
synced 2025-12-26 22:55:00 +08:00
Update zsh config
This commit is contained in:
parent
e1d9cc335d
commit
b6df12d988
2 changed files with 49 additions and 26 deletions
3
.config/zsh/.zprofile
Normal file
3
.config/zsh/.zprofile
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
if systemctl -q is-active graphical.target && [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
|
||||
xinit -- vt$XDG_VTNR
|
||||
fi
|
||||
|
|
@ -1,44 +1,65 @@
|
|||
# zle基础配置
|
||||
setopt no_beep # 不响铃
|
||||
setopt correct # 修正命令
|
||||
setopt interactive_comments # 交互模式支持注释
|
||||
|
||||
# 历史记录 <<<--------------------------
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=100000
|
||||
setopt nomatch
|
||||
setopt share_history
|
||||
# 写入时去掉重复和空白
|
||||
setopt hist_ignore_dups hist_reduce_blanks
|
||||
# >>>-----------------------------------
|
||||
|
||||
# 命令补全 <<<--------------------------
|
||||
autoload -Uz compinit
|
||||
# 注意: 指定缓存文件所在目录必须先确保该目录存在!
|
||||
compinit -d ${XDG_CACHE_HOME}/zsh/zcompdump-${ZSH_VERSION}
|
||||
setopt complete_aliases # 补全别名
|
||||
setopt list_packed # 补全列表压缩列宽
|
||||
zstyle :compinstall filename ${XDG_CONFIG_HOME}/zsh/.zshrc
|
||||
zstyle ':completion:*' menu select
|
||||
# 模糊修正
|
||||
zstyle ':completion:*' matcher-list '' 'm:{-a-zA-Z}={_A-Za-z}'
|
||||
# >>>-----------------------------------
|
||||
|
||||
# 按键绑定 <<<--------------------------
|
||||
bindkey -e
|
||||
zstyle :compinstall filename '/home/helia/.zshrc'
|
||||
zstyle ':completion:*' matcher-list '' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}'
|
||||
# >>>-----------------------------------
|
||||
|
||||
# !make sure the folder exists!
|
||||
autoload -Uz compinit && compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION
|
||||
|
||||
source /usr/share/git/completion/git-prompt.sh
|
||||
# 提示符 <<<----------------------------
|
||||
setopt prompt_subst
|
||||
autoload -Uz promptinit
|
||||
promptinit
|
||||
autoload -Uz colors
|
||||
colors
|
||||
setopt transient_rprompt # 右提示符只出现一次
|
||||
PROMPT='%F{magenta}%B$(__git_ps1) %1~>%b%f '
|
||||
RPROMPT='[%F{yellow}%?%f]%F{green}%n@%m Lv.%L%f'
|
||||
# git <<<-------------------------------
|
||||
source /usr/share/git/completion/git-prompt.sh
|
||||
GIT_PS1_SHOWDIRTYSTATE=1
|
||||
GIT_PS1_SHOWSTASHSTATE=1
|
||||
GIT_PS1_SHOWUNTRACKEDFILES=1
|
||||
GIT_PS1_SHOWUPSTREAM="auto"
|
||||
GIT_PS1_DESCRIBE_STYLE="default"
|
||||
# >>>-----------------------------------
|
||||
# >>>-----------------------------------
|
||||
|
||||
setopt completealiases
|
||||
setopt appendhistory share_history hist_ignore_dups
|
||||
setopt listpacked
|
||||
setopt transient_rprompt
|
||||
|
||||
autoload -U promptinit colors
|
||||
promptinit; colors
|
||||
# precmd () { __git_ps1 "%n" ":%~$ " "|%s" }
|
||||
PROMPT='%F{5}%B$(__git_ps1) %1~>%b%f '
|
||||
RPROMPT='%F{5}%B%d%b%f'
|
||||
|
||||
# extension <<<-------------------------
|
||||
source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
# >>>-----------------------------------
|
||||
|
||||
# alias <<<-----------------------------
|
||||
alias sudo='sudo '
|
||||
|
||||
alias e='nvim' && compdef e='nvim'
|
||||
alias g='git' && compdef g='git'
|
||||
alias glg='git lg'
|
||||
alias p='python' && compdef p='python'
|
||||
alias e='nvim' && compdef e=nvim
|
||||
alias g='git' && compdef g=git
|
||||
alias p='python' && compdef p=python
|
||||
alias mitm='proxychains -f ~/Archway/proxychains-mitm.conf'
|
||||
alias gfw='proxychains -f ~/Archway/proxychains-gfw.conf'
|
||||
alias config='/usr/bin/git --git-dir=$HOME/.myconf/ --work-tree=$HOME'
|
||||
alias config='/usr/bin/git --git-dir=$HOME/.myconf/ --work-tree=$HOME' && compdef config=git
|
||||
|
||||
alias sl='ls'
|
||||
alias l='ls -l --color=auto'
|
||||
|
|
@ -61,7 +82,6 @@ pmi() { pacman -Qi $1 2>/dev/null || pacman -Sii $1 }
|
|||
pmo() { pacman -Qoq $1 2>/dev/null || pkgfile -i $1 }
|
||||
pml() { (pacman -Qlq $1 2>/dev/null || pkgfile -lq $1) | sed '/\/$/d' }
|
||||
pmb() { pacman -Ql $1 | awk -F/ '/\/usr\/bin\/.+[^/]$/{print $NF}' }
|
||||
# >>>-----------------------------------
|
||||
|
||||
if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
|
||||
exec startx "$XDG_CONFIG_HOME/X11/xinitrc"
|
||||
fi
|
||||
# vim: foldmethod=marker:foldmarker=<<<---,>>>---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue