ubuntu18.04系列3--oh my zsh安装

1、安装

sudo apt update
sudo apt-get install zsh

将默认的shell从bash改为zsh

chsh -s /bin/zsh 

重新启动

sudo reboot

这两个命令可以查看安装的shell以及当前的shell:

cat /etc/shells
echo $SHELL

配置zsh略微复杂,可以直接使用Oh-My-Zsh进行配置,以下三种命令,任何一种均可

MethodCommand
curlsh -c “$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”
wgetsh -c “$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”
fetchsh -c “$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”

也可以手动进行安装

wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
sh install.sh

或者下面的命令

wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

2、更换zsh主题

官网可以查看主题风格介绍举例
编辑~/.zshrc文件
修改ZSH_THEME="robbyrussell",我比较喜欢jispwoso主题,就更换为这个主题,然后保存并重新启动你的终端。
在这里插入图片描述
主题风格如下;

在这里插入图片描述

3、zsh插件

3.1 vscode

官网插件安装说明
安装

git clone https://github.com/valentinocossar/vscode.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/vscode

修改~/.zshrc文件如下,保存并使修改的文件生效source .zshrc
在这里插入图片描述

命令如下
Common aliases

AliasCommandDescription
vsccode .Open the current folder in VS code
vsca dircode --add dirAdd folder(s) to the last active window
vscd file filecode --diff file fileCompare two files with each other.
vscg file:line[:char]code --goto file:line[:char]Open a file at the path on the specified line and character position.
vscncode --new-windowForce to open a new window.
vscrcode --reuse-windowForce to open a file or folder in the last active window.
vscwcode --waitWait for the files to be closed before returning.
vscu dircode --user-data-dir dirSpecifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.

Extensions aliases

AliasCommandDescription
vsced dircode --extensions-dir dirSet the root path for extensions.
vscie id or vsix-pathcode --install-extension extension-id> or <extension-vsix-pathInstalls an extension.
vscue id or vsix-pathcode --uninstall-extension id or vsix-pathUninstalls an extension.

Other options:

AliasCommandDescription
vscvcode --verbosePrint verbose output (implies --wait).
vscl levelcode --log levelLog level to use. Default is ‘info’. Allowed values are ‘critical’, ‘error’, ‘warn’, ‘info’, ‘debug’, ‘trace’, ‘off’.
vscdecode --disable-extensionsDisable all installed extensions.

3.2 zsh-autosuggestions

官网安装说明
记录你之前输入过的所有命令,并且自动匹配你可能想要输入命令,然后按Tab补全

安装

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

修改~/.zshrc文件如下,保存并使修改的文件生效source .zshrc

plugins=( 
    # other plugins...
    zsh-autosuggestions
)

3.3 zsh-syntax-highlighting

官网安装说明
在输入命令时提示当前命令是否正确,错误红色,正确绿色

安装

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

修改~/.zshrc文件如下,保存并使修改的文件生效source .zshrc

plugins=( 
    # other plugins...
    zsh-syntax-highlighting
)

4、终端透明度设置

打开终端,在窗口中点击右键,选择Preferences,如下图设置,拖动滑块即可修改终端的透明度
在这里插入图片描述最终效果如下:

在这里插入图片描述

5、docker自动切换到zsh

.bashrc的一些配置复制到.zshrc,在~路径下新建.bash_profile

touch .bash_profile

在文件中添加

export PATH=/bin:/usr/bin:/usr/local/bin:$PATH

保存关闭,在.zshrc中添加

source ~/.bash_profile
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值