ubuntu使用zsh进行命令行自动补全
1、zsh下载及配置
安装zsh
sudo apt-get install cmake git zsh
安装ohmyzsh
wget -p ~/ https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh
sudo chmod +x ~/install.sh
sh ~/install.sh
若找不到install.sh
,则直接到ohmyzsh仓库中下载install.sh
文件,然后到下载目录下加读写权限,然后安装
sudo chmod +x ~/install.sh
sh ~/install.sh
安装必要的插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
出现网络问题时
git clone http://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone http://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
修改zshrc
gedit ~/.zshrc
在文件中添加
plugins=(git
zsh-autosuggestions
zsh-syntax-highlighting
)
alias ezs="gedit ~/.zshrc"
alias szs="source ~/.zshrc"
alias sss="source devel/setup.zsh"
# source /opt/ros/melodic/setup.zsh # 注意ros版本
# export PATH=~/anaconda3/bin:$PATH
setopt no_nomatch # 允许使用 *缺省
使能代码提示
先别急着关闭.zshrc
文件,ctrl+f
找到plugins=(git)
这一行,如果没有添加。更改为如下
plugins=(git zsh-autosuggestions)
2、安装terminator终端
sudo apt-get install terminator
安装后创建目录,以修改不同的终端风格
mkdir ~/.config/terminator
gedit ~/.config/terminator/config
我的终端风格
[global_config]
suppress_multiple_term_dialog = True
title_font = Ubuntu Mono 11[keybindings]
[keybindings]
[layouts]
[[default]]
[[[child1]]]
parent = window0
type = Terminal
[[[window0]]]
parent = ""
size = 800, 500
type = Window
[plugins]
[profiles]
[[default]]
background_color = "#484343"
background_darkness = 0.8
background_type = transparent
font = Ubuntu Mono 15
foreground_color = "#e0f0f1"
show_titlebar = False
use_system_font = False
效果
方案二
[global_config]
suppress_multiple_term_dialog = True
title_font = Ubuntu Mono 11[keybindings]
title_inactive_fg_color = "#8ae234"
title_transmit_fg_color = "#ce5c00"
[keybindings]
[layouts]
[[default]]
[[[child1]]]
parent = window0
type = Terminal
[[[window0]]]
parent = ""
size = 800, 500
type = Window
[plugins]
[profiles]
[[default]]
background_color = "#000000"
background_type = transparent
cursor_color = "#e0f0f1"
font = Ubuntu Mono 15
foreground_color = "#e0f0f1"
show_titlebar = False
use_system_font = False
保存后重启terminator即可
3、进入zsh终端
输入如下即可进入zsh终端
zsh
退出zsh
exit
每次打开进入zsh
chsh -s /bin/zsh