Linux安装oh-my-zsh

安装zsh

sudo apt install zsh -y

查看zsh版本
zsh --version

查看linux下所有shell环境
cat /etc/shells

切换shell为zsh
chsh -s /bin/zsh
原shell为/bin/bash

重启terminal,查看当前shell
echo $SHELL

安装oh-my-zsh

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

oh-my-zsh主题在以下位置:
~/.oh-my-zsh/themes

安装自动提示插件
wget http://mimosa-pudica.net/src/incr-0.2.zsh && mkdir ~/.oh-my-zsh/plugins/incr && mv incr-0.2.zsh ~/.oh-my-zsh/plugins/incr

echo 'source ~/.oh-my-zsh/plugins/incr/incr*.zsh' >> ~/.zshrc

source ~/.zshrc

安装autojump
sudo apt install autojump

git clone git://github.com/joelthelion/autojump.git

cd autojump && ./install.py

安装完成后在.zshrc里面加一行
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

之后运行以下命令:
autoload -U compinit && compinit -u

安装字体及主题

安装Powerline fonts
sudo apt install fonts-powerline

安装ttf-ancient-fonts
sudo apt install ttf-ancient-fonts -y

安装bullet-train主题
bullet-train

1
2
3
4
5
mv bullet-train.zsh-theme ~/.oh-my-zsh/themes

vi ~/.zshrc

ZSH_THEME="bullet-train"

其他配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 历史记录显示时间
HIST_STAMPS="yyyy-mm-dd"

# 支持256色
export TERM="xterm-256color"

# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias em='emacs -nw'
alias dd='dd status=progress'
alias _='sudo'
alias _i='sudo -i'
alias lh='ls -lh'
alias lah='ls -lAH'
alias lha='ls -lAH'
alias cl='clear'
alias vi='vim'
alias py='python'
alias py2='python'
alias py3='python3'
alias ipy3='ipython3'
alias ipy='ipython'
alias ipy2='ipython'
alias pycharm="'/opt/pycharm-2018.1.4/bin/pycharm.sh' %f"
alias postman="/opt/Postman/Postman"
alias ssr='ssr start'

# 隐藏主机名和用户名
prompt_context () { }

# Virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

# Java
export JAVA_HOME=/opt/jdk1.8.0_151
export JRE_HOME=$JAVA_HOME/jre
export PENTAHO_JAVA_HOME=$JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib

# Go
export GOROOT=/usr/local/share/go
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN
export GOPATH=$HOME/Desktop/Programming/Go

# Bin
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

[1]参考链接

[2]参考链接

0%