a guide powered by zsh + oh-my-zsh + tmux + oh-my-tmux
- Linux platform (e.g. Ubuntu 20.04)
root
orsudo
privilege- basic tools such as
curl
andgit
- purely available network environment
Install zsh
via apt
.
$ sudo apt install zsh
Check whether zsh
is available.
$ cat /etc/shells
# /etc/shells: valid login shells
/usr/bin/zsh
Install oh-my-zsh
via curl
. You can also use wget
referred to oh-my-zsh. Note that proxy may be needed.
$ cd
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Change login shell into zsh
and then re-login.
$ chsh -s /bin/zsh
Check whether zsh
is login shell now.
$ echo $SHELL
/bin/zsh
If you are using vscode
remote development, you should
- kill
vscode-server
in command panel - modify
default terminal
in remote settings
These operations are necessary to make zsh
the default shell.
agnoster
theme is recommended.
$ vim ~/.zshrc
ZSH_THEME="agnoster"
Install zsh-autosuggestions
and zsh-syntax-highlighting
plugins and enable them.
$ git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
$ vim ~/.zshrc
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
Install tmux
via apt
.
$ sudo apt install tmux
If tmux
is already installed, restart it.
$ tmux kill-server
Install oh-my-tmux
from github
. My customized fork is used here. You can also start from oh-my-tmux instead.
$ cd
$ git clone https://github.com/xxyQwQ/.tmux
$ ln -sf .tmux/.tmux.conf
$ cp .tmux/.tmux.conf.local .
If you already have some customized settings in .bashrc
, copy and append them to .zshrc
. This promises your previous configurations are still available.
$ vim ~/.zshrc
# proxy setting
if [ -f /etc/profile.d/clash.sh ]; then
. /etc/profile.d/clash.sh
fi
When you install anaconda
, auto activation is recommended to be disabled. Otherwise, PATH
could be switched incorrectly when you enter tmux
.
$ vim ~/.condarc
auto_activate_base: false
Hostname can be too long and meaningless. Hack the configurations to improve it.
For oh-my-zsh
, modify agnoster.zsh-theme
.
$ vim ~/.oh-my-zsh/themes/agnoster.zsh-theme
prompt_context() {
if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)%n"
fi
}
For oh-my-tmux
, modify ~/.tmux.conf.local
.
$ vim ~/.tmux.conf.local
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} "