Linux安装zsh,更好用的终端,zsh添加插件

1.安装zsh 

编译安装

在官网下载源码包:https://sourceforge.net/projects/zsh/

安装zsh

$ tar -zxvf zsh-5.7.1.tar.xz

$ ./configure

$ make && make install 

直接安装

sudo apt install zsh

查看安装是否成功

$ cat ~/.zshrc --version

$ cat /home/$User/.zshrc

cat (GNU coreutils) 8.25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjörn Granlund and Richard M. Stallman.

2.更改默认Shell(可忽略)

默认的shell是bash,需要修改成zsh。先写入shells

$cat /etc/shells 
# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/bin/zsh
/usr/bin/zsh
/usr/bin/screen

更改默认shell ,跟改后需要重开终端

$chsh -s /usr/local/bin/zsh 

 查看当前shell

$ echo $SHELL
/usr/local/bin/zsh

3.基于oh-my-zsh进行配置zsh

omz是类似与构建zsh框架的东西,使用omz就行布局配置

ubuntu: 

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" 

centos

wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh && ./install.sh

安装后结果如下:

4.更改OMZ主题

默认是robbyrussell,我们可以更改为ys(界面比较清晰),下面是配置文件,标粗的位置更改为ys即可

vim ~/.zshrc 找到 ZSH_THEME="robbyrussell" 改为ZSH_THEME="ys"

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/root/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

#修改主题
ZSH_THEME="robbyrussell"

~~~~~~

thems所有的主题在这个目录下 :/root/.oh-my-zsh/themes

在这里插入图片描述

5. zsh装插件

1. 插件一,高亮错误输入:zsh-syntax-highlighting

在git上获取到插件

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git

$ mv zsh-syntax-highlighting ~/.oh-my-zsh/plugins/zsh-syntax-highlighting

在配置文件中添加,~/.oh-my-zsh,编译~/.zshrc

$ echo "plugins=(zsh-syntax-highlighting)" >> ~/.zshrc

$ source ~/.zshrc

其他常用插件:https://www.jianshu.com/p/a94e2c59f244

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值