mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
update re5et theme
This commit is contained in:
parent
21a781a722
commit
807338f7e5
1 changed files with 59 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ PROMPT='
|
||||||
|
|
||||||
RPS1='${return_code} %D - %*'"$RPS1"
|
RPS1='${return_code} %D - %*'"$RPS1"
|
||||||
|
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%}^%{$reset_color%}%{$fg_bold[yellow]%}"
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[magenta]%} -git- %{$reset_color%}%{$fg_bold[yellow]%}"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±"
|
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%} ±"
|
||||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?"
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ?"
|
||||||
|
|
@ -52,3 +52,61 @@ check-cmd-backward-delete-char() { zle .backward-delete-char && recolor-cmd }
|
||||||
|
|
||||||
zle -N self-insert check-cmd-self-insert
|
zle -N self-insert check-cmd-self-insert
|
||||||
zle -N backward-delete-char check-cmd-backward-delete-char
|
zle -N backward-delete-char check-cmd-backward-delete-char
|
||||||
|
|
||||||
|
#关于历史纪录的配置 {{{
|
||||||
|
#历史纪录条目数量
|
||||||
|
export HISTSIZE=10000
|
||||||
|
#注销后保存的历史纪录条目数量
|
||||||
|
export SAVEHIST=10000
|
||||||
|
#历史纪录文件
|
||||||
|
export HISTFILE=~/.zhistory
|
||||||
|
#以附加的方式写入历史纪录
|
||||||
|
setopt INC_APPEND_HISTORY
|
||||||
|
#如果连续输入的命令相同,历史纪录中只保留一个
|
||||||
|
setopt HIST_IGNORE_DUPS
|
||||||
|
#为历史纪录中的命令添加时间戳
|
||||||
|
setopt EXTENDED_HISTORY
|
||||||
|
|
||||||
|
#启用 cd 命令的历史纪录,cd -[TAB]进入历史路径
|
||||||
|
setopt AUTO_PUSHD
|
||||||
|
#相同的历史路径只保留一个
|
||||||
|
setopt PUSHD_IGNORE_DUPS
|
||||||
|
|
||||||
|
#在命令前添加空格,不将此命令添加到纪录文件中
|
||||||
|
#setopt HIST_IGNORE_SPACE
|
||||||
|
#}}}
|
||||||
|
|
||||||
|
#每个目录使用独立的历史纪录{{{
|
||||||
|
cd() {
|
||||||
|
builtin cd "$@" # do actual cd
|
||||||
|
fc -W # write current history file
|
||||||
|
local HISTDIR="$HOME/.zsh_history$PWD" # use nested folders for history
|
||||||
|
if [ ! -d "$HISTDIR" ] ; then # create folder if needed
|
||||||
|
mkdir -p "$HISTDIR"
|
||||||
|
fi
|
||||||
|
export HISTFILE="$HISTDIR/zhistory" # set new history file
|
||||||
|
touch $HISTFILE
|
||||||
|
local ohistsize=$HISTSIZE
|
||||||
|
HISTSIZE=0 # Discard previous dir's history
|
||||||
|
HISTSIZE=$ohistsize # Prepare for new dir's history
|
||||||
|
fc -R #read from current histfile
|
||||||
|
}
|
||||||
|
mkdir -p $HOME/.zsh_history$PWD
|
||||||
|
export HISTFILE="$HOME/.zsh_history$PWD/zhistory"
|
||||||
|
|
||||||
|
function allhistory { cat $(find $HOME/.zsh_history -name zhistory) }
|
||||||
|
function convhistory {
|
||||||
|
sort $1 | uniq |
|
||||||
|
sed 's/^:\([ 0-9]*\):[0-9]*;\(.*\)/\1::::::\2/' |
|
||||||
|
awk -F"::::::" '{ $1=strftime("%Y-%m-%d %T",$1) "|"; print }'
|
||||||
|
}
|
||||||
|
#使用 histall 命令查看全部历史纪录
|
||||||
|
function histall { convhistory =(allhistory) |
|
||||||
|
sed '/^.\{20\} *cd/i\\' }
|
||||||
|
#使用 hist 查看当前目录历史纪录
|
||||||
|
function hist { convhistory $HISTFILE }
|
||||||
|
|
||||||
|
#全部历史纪录 top50
|
||||||
|
function top50 { allhistory | awk -F':[ 0-9]*:[0-9]*;' '{ $1="" ; print }' | sed 's/ /\n/g' | sed '/^$/d' | sort | uniq -c | sort -nr | head -n 50 }
|
||||||
|
|
||||||
|
#}}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue