当前位置: 首页 > 工具软件 > Oh My Fish > 使用案例 >

Linux 安装 zsh & oh-my-zsh

乜明朗
2023-12-01

一、安装zsh和选择zsh

yum install zsh 
zsh --version 
cat /etc/shells
chsh -s /bin/zsh

二、安装 oh my zsh

$ wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
或
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
或
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh 

卸载:

uninstall_oh_my_zsh 

三、配置主题

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

vim ~/.zshrc
   ZSH_THEME="ys"
   disable_auto_update = true

四、配置插件

1、Incremental 自动补全插件(智能提示)

mkdir ~/.oh-my-zsh/plugins/incr
wget -P ~/.oh-my-zsh/plugins/incr  http://mimosa-pudica.net/src/incr-0.2.zsh

source ~/.oh-my-zsh/plugins/incr/incr*.zsh

2、zsh-syntax-highlighting

描述:日常用的命令会高亮显示,命令错误显示红色

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

3、 zsh-autosuggestion


描述:输入命令时可提示自动补全(灰色部分),然后按键盘 → 即可补全,有效路径会有下划线。
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

4、 autojump

描述:实现目录间快速跳转,想去哪个目录直接 j + 目录名,不用在频繁的 cd 了! quyin die

linux 系统
git clone git://github.com/wting/autojump.git
cd autojump
./install.py or ./uninstall.py

[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh &&  autoload -U compinit && compinit -u
autojump --help
autojump --purge 
j --stat

5、zsh-completions


git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions

plugins=(… zsh-completions)

五、配置文件:

# cat ~/.zshrc| grep -v "#"| grep -v "^$"
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="ys"
plugins=(git   colored-man-pages  zsh_reload sudo zsh-completions autojump zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh

#source ~/.oh-my-zsh/plugins/incr/incr*.zsh
source ~/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh 
autoload -U compinit && compinit -u

六、 fish shell

官网:http://fishshell.com/#platform_tabs

对于 RHEL 7,请以根用户 root 运行下面命令:

cd /etc/yum.repos.d/
wget https://download.opensuse.org/repositories/shells:fish:release:3/RHEL_7/shells:fish:release:3.repo
yum install fish

 

 类似资料: