Ubuntu终端ZSH配置

oh-my-zsh是zsh的一个框架,内置了许多主题和插件。

ZSH安装

安装

sudo apt install zsh

作为默认终端

chsh -s /bin/zsh

oh-my-zsh安装

oh-my-zsh是zsh的一个框架,内置了许多主题和插件。

sh -c "$(curl -fsSL https://gitee.com/shmhlsy/oh-my-zsh-install.sh/raw/master/install.sh)"

常用插件安装

#自动补齐
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh}/plugins/zsh-autosuggestions

#语法高亮
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh}/plugins/zsh-syntax-highlighting

#自动跳转
sudo apt-get install autojump

vim ~/.zshrc

#在 plugins 行添加插件名,如:
plusgins=(git zsh-autosuggestions zsh-syntax-highlighting)

#最后一行添加
. /usr/share/autojump/autojump.sh

#使配置生效
source ~/.zshrc

ZSH常见问题

  • 不显示当前工作目录

    直接修改主题的设置

    vim ~/.oh-my-zsh/themes/robbyrussell.zsh-theme
    

    找到%{$fg[cyan]%}%c%{$reset_color%},并将其中的%c改成%d。

  • 无法连接github

出现报错信息如下

Failed to connect to github.com port 443: Timed out

这里不做过多的研究,一般认为是代理的问题。

git config --global https.proxy #设置代理
git config --global --unset https.proxy #取消设置代理

略略略

  • 框架可以使用zim或者其他的,提高运行性能。