安装与配置zsh

安装与配置zsh

  • 查看是否安装有zsh
  • 安装zsh
  • 切换shell为zsh
  • 查看当前shell
  • 配置zsh

apt安装zsh

查看是否安装有zsh

cat /etc/shells

安装zsh

sudo apt install zsh

切换shell为zsh

chsh -s %(which zsh)

查看当前shell

echo $SHELL

源码安装zsh

下载zsh
wget https://nchc.dl.sourceforge.net/project/zsh/zsh/5.8/zsh-5.8.tar.xz
解压并安装
解压
tar xvf zsh-5.8.tar.xz
安装
cd zsh-5.8
./configure --prefix=$HOME/.local
make && make install
配置环境变量
vim .bashrc
添加
export PATH=$PATH:$HOME/.local/bin	# 设置环境变量
export SHELL=`which zsh`      		# 设置$SHELL为zsh
exec `which zsh` -l           		# 设置登录为zsh

配置zsh

安装oh-my-zsh
  • 从github安装
 wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
 zsh install.sh
  • 从gitee安装

    1.下载安装文件
    wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh
    2.修改install.sh文件内容
    找到以下内容
    ----------------------------------------------------------------
    # Default settings
    ZSH=${ZSH:-~/.oh-my-zsh}
    REPO=${REPO:-ohmyzsh/ohmyzsh}
    REMOTE=${REMOTE:-https://github.com/${REPO}.git}
    BRANCH=${BRANCH:-master}
    ----------------------------------------------------------------
    将其中的第3,4行替换为以下内容
    ----------------------------------------------------------------
    REPO=${REPO:-mirrors/oh-my-zsh}
    REMOTE=${REMOTE:-https://gitee.com/${REPO}.git}
    ----------------------------------------------------------------
    3.保存文件,赋予执行权限
    4.执行
    5.修改仓库地址
    cd ~/.oh-my-zsh
    git remote set-url origin https://gitee.com/mirrors/oh-my-zsh.git
    git pull
    6.结束
    
修改主题为ys主题

vim ~/.zshrc
修改:ZSH_THEME="ys"

修改ys主题(可选)

vim ~/.oh-my-zsh/themes/ys.zsh-theme
修改49行以下内容,去掉主机名
1MFgdx.png

安装插件
  • autosuggestioins
  • syntax-highlighting
  • 安装autojump
安装autosuggestioins
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://gitee.com/phpxxo/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
安装syntax-highlighting
github
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
gitee
git clone https://gitee.com/wxzxingtian/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
加载插件
$ vim ~/.zshrc
修改以下内容
plugins=(git)为
plugins=(git extract zsh-autosuggestions zsh-syntax-highlighting)

$ source~/.zshrc
posted @   roverqqq  阅读(258)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示