如何配置趁手的命令行环境
村民1号 | June 20, 2022
如果你的命令行 shell 是 bash,你可以跟随这个教程配置更好用的 zsh 。
Introduction #
如何查看自己的 shell 的类型?
请在命令行键入以下命令
echo $SHELL
效果 #
你的命令行将支持
- 语法高亮
- git 提示
- 自动补全
- 更棒的历史记录
- 等
示意
方法 #
- 设置默认 shell 为 zsh
chsh -s /bin/zsh
- 进入 zsh
zsh
第一次使用会弹出是否新建配置文件,选 populate .zshrc
- 配置
oh my zsh
sh -c "$(wget https://gitee.com/Devkings/oh_my_zsh_install/raw/master/install.sh -O -)"
- 配置高亮,自动补全插件
先执行这两
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
然后修改配置文件
vim ~/.zshrc
找到如下这行配置代码,在后面追加插件名
plugins=(zsh-autosuggestions zsh-syntax-highlighting)