Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
分享一个zsh配置文件
Apps Section
1081
views ·
2
replies ·
To
floor
Go
Bluek404
deepin
2015-01-02 11:20
Author
DeepinScreenshot20150102030831.png
修改自:
http://blog.chinaunix.net/uid-26495963-id-3193686.html
去掉了一般用户用不到的功能(比如把里面的命令别名都删了,刚开始还是打全命令学的快一点),以及修改了一下命令提示符样式和加入历史记录补全
Shift+↑或↓可以自动补全历史记录
比如你上次输入了print 123
然后想再使用一遍
但是又输入了很多别的命令
一条一条翻历史记录太慢
就可以先输入前几个字符,比如prin
然后按Shift+↑就可以快速补全成print 123了
把下面的文本保存到用户目录的 .zshrc 文件中就行
# 历史纪录条目数量
export HISTSIZE=10000
# 注销后保存的历史纪录条目数量
export SAVEHIST=10000
# 历史纪录文件
export HISTFILE=~/.zsh_history
# 以附加的方式写入历史纪录
setopt INC_APPEND_HISTORY
# 如果连续输入的命令相同,历史纪录中只保留一个
setopt HIST_IGNORE_DUPS
# 为历史纪录中的命令添加时间戳
setopt EXTENDED_HISTORY
# 在命令前添加空格,不将此命令添加到纪录文件中
setopt HIST_IGNORE_SPACE
# 输入前半部分然后 Shift + ↑/↓ 自动补全命令历史
bindkey "^[[1;2A" history-search-backward
bindkey "^[[1;2B" history-search-forward
# 启用颜色显示
autoload colors
colors
# 启用ls颜色分类
ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G'
# 自定义命令提示符
PROMPT=$(echo -e "\033[36m%M \033[32m> \033[36m%n \033[32m> \033[0m%~\n%{$fg[green]%}>> %{$reset_color%}")
# 自动补全功能
setopt AUTO_LIST
setopt AUTO_MENU
# 启用自动补全TAB选单
zstyle ':completion:*' menu select
# 路径补全
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*' squeeze-slashes 'yes'
zstyle ':completion::complete:*' '\\'
# 修正大小写
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
# 错误校正
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
# kill 命令补全
compdef pkill=killall
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:*:*:*:processes' force-list always
zstyle ':completion:*:processes' command 'ps -au$USER'
# 补全类型提示分组
zstyle ':completion:*:matches' group 'yes'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'
zstyle ':completion:*:descriptions' format $'\e[01;33m -- %d --\e[0m'
zstyle ':completion:*:messages' format $'\e[01;35m -- %d --\e[0m'
zstyle ':completion:*:warnings' format $'\e[01;31m -- No Matches Found --\e[0m'
zstyle ':completion:*:corrections' format $'\e[01;32m -- %d (errors: %e) --\e[0m'
Copy the Code
2015/1/2更新:
删除oh-my-zsh依赖
Reply
Like 0
Favorite
View the author
All Replies
MattD
deepin
2015-01-02 18:35
#1
前提:本机需要安装有oh-my-zsh
Reply
Like 0
View the author
Bluek404
deepin
2015-01-03 00:27
#2
前提:本机需要安装有oh-my-zsh
Deepin默认有的
Reply
Like 0
View the author
Please
sign
in first
Featured Collection
Change
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
Deepin 25.2.0 Black Screen After Sleep
Problem With AMD-pstates
lightdm-deepin-greeter fails to read display scale on fresh 25.2.0
UI freezes and extraction is slower CliPzipPlugin runs on GUI thread
OBS Flatpak with Treeland
login to bbs.deepin.org only works without ipv6
Popular Events
More
修改自: http://blog.chinaunix.net/uid-26495963-id-3193686.html
去掉了一般用户用不到的功能(比如把里面的命令别名都删了,刚开始还是打全命令学的快一点),以及修改了一下命令提示符样式和加入历史记录补全
Shift+↑或↓可以自动补全历史记录
比如你上次输入了print 123
然后想再使用一遍
但是又输入了很多别的命令
一条一条翻历史记录太慢
就可以先输入前几个字符,比如prin
然后按Shift+↑就可以快速补全成print 123了
把下面的文本保存到用户目录的 .zshrc 文件中就行
2015/1/2更新:
删除oh-my-zsh依赖