修改zsh time命令的结果

~/.zshrc添加如下内容

TIMEFMT='%J   %U  user %S system %P cpu %*E total'$'\n'\
'avg shared (code):         %X KB'$'\n'\
'avg unshared (data/stack): %D KB'$'\n'\
'total (sum):               %K KB'$'\n'\
'max memory:                %M MB'$'\n'\
'page faults from disk:     %F'$'\n'\
'other page faults:         %R'

修改命令的提示

PROMPT="%{$fg_bold[green]%}%n%{$fg[blue]%}@%{$fg_bold[yellow]%}%m %(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT+='%{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)
%# '

ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"

PROMPT的语法

https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html

添加改变标题功能

DISABLE_AUTO_TITLE="true"

function tabtitle() {
  echo -en "\e]2;[email protected]\a"
}

在shell中通过tabtitle my title即可将当前shell的标题修改为my title.

others

alias acp="xargs echo -n | xclip -sel clip"
alias xcp="xargs echo -n | xclip -sel clip"
alias makea="make clean && make -j"
alias a2="aria2c"

Reference

https://unix.stackexchange.com/questions/136423/making-zsh-default-shell-without-root-access


文章版权归 FindHao 所有丨本站默认采用CC-BY-NC-SA 4.0协议进行授权|
转载必须包含本声明,并以超链接形式注明作者 FindHao 和本文原始地址:
https://findhao.net/easycoding/2593.html

Comments