介绍
用 oh-my-zsh 简单配置 zsh
安装 oh-my-zsh
安装 zsh,并设为默认终端,这一步需要自行重启,安装 ohmyzsh。
sudo apt-get install zsh
chsh -s /bin/zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
插件
- fzf-tab
NOTE: fzf-tab needs to be loaded aftercompinit
, but before plugins which will wrap widgets, such as zsh-autosuggestions or fast-syntax-highlighting!!
NOTE 2: fzf-tab ALSO needs fzf installed, otherwise it cannot work! - fast-syntax-highlighting
- zsh-autosuggestions
git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
好用工具
.zshrc
中用 alias
替换系统默认工具, 可以选择性安装下面的好用工具:
- Modern Unix
- z.lua
- lvim
- ranger
- lf
- thefuck
配置文件
.zshrc
里面重要的配置:
plugins=(
fzf-tab #注意顺序
zsh-autosuggestions
fast-syntax-highlighting
...
)
# lunarvim
alias vi='lvim'
# awesome tolls
alias ls='exa --icons'
alias cat="batcat --paging=never"
# zlua
eval "$(lua $HOME/path/to/z.lua/z.lua --init zsh enhanced once echo fzf)"
# thefuck
eval $(thefuck --alias)
tab 无效
fzf-tab 可能无法成功加载,检查自己 fzf 是不是最新版本。最好卸载用git装:
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
重启终端生效。