Ubuntu 安装 zsh shell 及其插件、主题等

简介: 1、安装zshsudo apt-get install -y zsh2、安装 oh my zshsh -c "$(curl -fsSL https://raw.

1、安装zsh

sudo apt-get install -y zsh

2、安装 oh my zsh

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

3、安装插件

下载

cd ~/.oh-my-zsh/custom/plugins

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

配置:

sudo vim .zshrc

添加 zsh-autosuggestions

plugins=(

git

zsh-syntax-highlighting

)

保存退出!
然后source ~/.zshrc

下载(安装) git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

配置:

sudo vim .zshrc

添加 zsh-autosuggestions

plugins=(

git

zsh-syntax-highlighting

zsh-autosuggestions

)

保存退出!
然后source ~/.zshrc

  • 3) 命令检查 the fuck

python (3.4+) pip python-dev
安装:

sudo apt update

sudo apt install python3-dev python3-pip

sudo pip3 install thefuck

配置:
/.zshrc和/.bashrc 文件中添加如下代码:

eval $(thefuck --alias)

eval $(thefuck --alias FUCK)

刷新配置文件:
在bash中执行

source ~/.bashrc
在zsh中执行

source ~/.zshrc

    1. 给某个目录指定全局名字 wd

安装:

cd ~/.oh-my-zsh/custom/plugins

git clone https://github.com/mfaerevaag/wd.git

配置:

sudo vim .zshrc

添加 wd

plugins=(

git

zsh-syntax-highlighting

zsh-autosuggestions

wd

)

保存退出!
然后source ~/.zshrc

使用:

在某一个目录下如: /dev/code/shell

执行 /dev/code/shell 简化为 sh

wd add sh

然后 查看

wd ls sh

跳转 到/dev/code/shell

wd sh

  • 5)自动跳转 autojump

这个插件会记录你常去的那些目录,然后做一下权重记录,你可以用这个命令看到你的习惯:j --stat,如果这个里面有你的记录,那你就只要敲最后一个文件夹名字即可进入,比如我个人习惯的 program:j program,就可以直接到:/usr/program

安装:

sudo apt-get install autojump
配置:
激活 autojump 应用
为了暂时激活 autojump 应用,即直到你关闭当前会话或打开一个新的会话之前让 autojump 均有效,你需要以常规用户身份运行下面的命令:
source /usr/share/autojump/autojump.sh on startup
为了使得 autojump 在 BASH shell 和ZSH中永久有效,你需要运行下面的命令。
echo '. /usr/share/autojump/autojump.sh'>>~/.bashrc
echo '. /usr/share/autojump/autojump.sh'>>~/.zshrc
刷新配置文件:
在bash中执行

source ~/.bashrc
在zsh中执行

source ~/.zshrc
查看autojump的版本:
j -v

使用:

j --stat

4、 主题

官网所有主题 https://github.com/robbyrussell/oh-my-zsh/wiki/Themes

安装漂亮主题 Bullet Train for oh-my-zsh

前提条件:

fonts-powerline字体 Input Mono 或者 Monoid字体(推荐第一个,因为比较简单) 确保Ubuntu的ttf-ancient-fonts字体没有被上面的字体覆盖,如果覆盖可用尝试重新安装ttf-ancient-fonts字体 已安装antigen, oh-my-zsh or zgen等zsh框架 确保终端支持256色

安装字体:

下载字体,然后直接将其移动到/usr/share/fonts目录下即可。

下载 https://github.com/powerline/fonts

clone

git clone https://github.com/powerline/fonts.git --depth=1

install

cd fonts

./install.sh

clean-up a bit

cd ..

rm -rf fonts

安装主题:
下载主题文件: 把下载好的主题文件放到~/.oh-my-zsh/custom/themes目录下

cd ~/.oh-my-zsh/themes

cp bullet-train.zsh-theme ..

git clone https://github.com/caiogondim/bullet-train.zsh.git

配置:
修改~/.zshrc的ZSH_THEME参数,把原来的参数注释或者删掉,换成下面的
ZSH_THEME="bullet-train"
保存,然后刷新.zshrc文件
source ~/.zshrc

5、设置zsh为系统默认shell

为root用户修改默认shell为zsh

chsh -s /bin/zsh root
为当前用户修改默认shell为zsh
chsh -s /bin/zsh
恢复命令
chsh -s /bin/bash

6、卸载 Oh My Zsh (我觉得你会喜欢上的,不会卸载的)

卸载:终端输入 :

uninstall_oh_my_zsh

问题:

备注:如果使用vim编辑文件按Tab想自动补全文件名的时候出现了
_arguments:450: _vim_files: function definition file not found
_arguments:450: _vim_files: function definition file not found
_arguments:450: _vim_files: function definition file not found
尝试执行命令:rm $ZSH_COMPDUMP && exec zsh
然后关闭所有终端,再打开试试,问题就会解决!

目录
相关文章
|
22天前
|
Ubuntu NoSQL 关系型数据库
Ubuntu系统下安装常用软件
Ubuntu系统下安装常用软件
46 0
Ubuntu系统下安装常用软件
|
1月前
|
Ubuntu Linux C语言
Ubuntu下安装vscode,并解决终端打不开vscode的问题
Ubuntu下安装vscode,并解决终端打不开vscode的问题
135 0
|
2月前
|
存储 Ubuntu 网络协议
|
1月前
|
Ubuntu Docker 容器
如何在Ubuntu上安装Docker?
【2月更文挑战第10天】
243 0
|
2月前
|
负载均衡 Ubuntu 应用服务中间件
|
24天前
|
Ubuntu 关系型数据库 MySQL
Ubuntu 中apt 安装MySQL数据库
Ubuntu 中apt 安装MySQL数据库
66 0
|
3天前
|
Ubuntu 数据安全/隐私保护
在UBUNTU虚拟机上安装R软件包
在UBUNTU虚拟机上安装R软件包
|
3天前
|
存储 编解码 Ubuntu
0-零基础安装ubuntu(超详细安装步骤)
0-零基础安装ubuntu(超详细安装步骤)
|
4天前
|
Ubuntu Linux 定位技术
手把手教你优雅的安装虚拟机 Ubuntu —— 图文并茂
手把手教你优雅的安装虚拟机 Ubuntu —— 图文并茂
|
14天前
|
Ubuntu Python
WSL ubuntu 20.04安装python3
通过以上步骤,你可以在WSL的Ubuntu 20.04上成功安装Python 3。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
15 1