cat /etc/shells
manjaro
内置已经支持 zsh
centos
yum install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
or
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
chsh -s /bin/zsh
配置文件是 ~/.zshrc
修改配置后使用 source ~/.zshrc
生效
on-my-zsh 自带许多主题,输入 ls ~/.oh-my-zsh/themes
查看。
可以自己下载相关主题到此目录使用。如比较流行的 powerlevel10k 主题。可以输入
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
下载。
修改配置文件 ~/.zshrc 中的 ZSH_THEME 即可
sudo vim ~/.zshrc
如使用 ys 主题,那么就修改为
ZSH_THEME="ys"
然后输入 source ~/.zshrc
生效
bira,ys,powerlevel10k 等
也可以 改为 random ,那么每次 source ~/.zshrc
会随机使用一个主题。输入 echo $ZSH_THEME
查看当前主题。
ls ~/.oh-my-zsh/plugins
可以自己下载相关主题到此目录使用。
打开.zshrc 配置文件,定位到 plugins
vim ~/.zshrc
改为
plugins=(
git
pluginName1
pluginName2
pugginName3
)
然后 source ~/.zshrc
即可
自带插件。可以使用各种 git
命令缩写
查看所有 git
命令缩写
cat ~/.oh-my-zsh/plugins/git/git.plugin.zsh
自带插件。功能强大的解压插件,所有类型的文件解压一个命令 x
全搞定
自带插件。这是可以让终端直接呼出浏览器并搜索你输入的 Keywords。比如,想 Google 搜索 bitcoin - "google bitcoin"
自带插件。按两下 ESC
键,自动为前一个命令加上 sudo。
这个插件会根据历史输入指令的记录即时的提示
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
这是一个命令高亮插件,输入为绿色时表示正确的命令,路径带有下划线时表示可用路径
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
z.lua 类似 z/autojump/fasd, 是一个快速路径切换工具
首先安装 lua
sudo pacman -S lua
再下载
git clone https://github.com/skywind3000/z.lua.git ~/.oh-my-zsh/plugins/z.lua
然后在 ~/.zshrc 中加入
eval "$(lua ~/.oh-my-zsh/plugins/z.lua/z.lua --init zsh enhanced once echo)"
git clone https://github.com/paulirish/git-open.git $ZSH_CUSTOM/plugins/git-open
输入 fuck 纠正前一条输错的命令, 需要先下载
sudo pacman -S thefuck
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search
plugins=(zsh-history-substring-search)
export TERM="xterm-256color"
export ZSH="/home/tuling/.oh-my-zsh"
ZSH_THEME="ys"
# plugins
plugins=(
zsh-history-substring-search
sudo
git
web-search
extract
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
eval "$(lua /home/tuling/.oh-my-zsh/plugins/z.lua/z.lua --init zsh)"
eval $(thefuck --alias)
原文:https://www.cnblogs.com/just-save/p/12993717.html