19.2.4. Quality-of-Life Features
The Fast Way
sudo apt install -y zsh git curl wget byobu vim\
&& sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Choose zsh
as default by hitting enter.
# clone repo
mkdir -p "$HOME/.zsh"
git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"
# add path to ~/.zshrc, initialize prompt and choose pure (at the top of the file!)
echo 'fpath+=$HOME/.zsh/pure \nautoload -U promptinit; promptinit \nprompt pure' | cat - ~/.zshrc > temp && mv temp ~/.zshrc
# delete default theme entry
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME=""/' ~/.zshrc
# clone repo
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# add plugin to list of plugins
# assuming unchanged list containing only git, otherwise do this manually
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
echo "zstyle ':prompt:pure:path' color 075\nzstyle ':prompt:pure:prompt:success' color 214\nzstyle ':prompt:pure:user' color 119\nzstyle ':prompt:pure:host' color 119\nZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=161'" >> ~/.zshrc
echo "zstyle ':prompt:pure:path' color 075\nzstyle ':prompt:pure:prompt:success' color 214\nzstyle ':prompt:pure:user' color 119\nzstyle ':prompt:pure:host' color 119\nZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=161'" >> ~/.zshrc
echo "export TERM=xterm-256color" >> ~/.zshrc
source ~/.zshrc
byobu-enable
The Good Way
zsh
We prefer using the Z shell (zsh). To install:
sudo apt install -y zsh git curl
Install oh-my-zsh:
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Install the Pure prompt:
# clone repo
mkdir -p "$HOME/.zsh"
git clone https://github.com/sindresorhus/pure.git "$HOME/.zsh/pure"
# add path to ~/.zshrc, initialize prompt and choose pure (at the top of the file!)
echo 'fpath+=$HOME/.zsh/pure \nautoload -U promptinit; promptinit \nprompt pure' | cat - ~/.zshrc > temp && mv temp ~/.zshrc
# delete default theme entry
sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME=""/' ~/.zshrc
Install zsh-autosuggestions:
# clone repo
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# add plugin to list of plugins
# assuming unchanged list containing only git, otherwise do this manually
sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions)/' ~/.zshrc
Adjust colours of pure prompt and autosuggestions:
echo "zstyle ':prompt:pure:path' color 075\nzstyle ':prompt:pure:prompt:success' color 214\nzstyle ':prompt:pure:user' color 119\nzstyle ':prompt:pure:host' color 119\nZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=161'" >> ~/.zshrc
See the Pure Zstyle options and the Xterm265 colour chart for other settings and colours.
To avoid not seeing the nice colors we just selected:
echo "export TERM=xterm-256color" >> ~/.zshrc
To apply changes:
source ~/.zshrc
Byobu
To install Byobu, a terminal multiplexer:
sudo apt install byobu
Enable Byobu:
byobu-enable
Useful Shortcuts
Shortcut |
Function |
---|---|
F2 |
Open new terminal window |
F3 |
Move to previous window |
F4 |
Move to next window |
F6 |
Detach from this session |
Ctrl + A and then Ctrl + D |
Also Detach from this session. The first time you use this, you will be asked whether you want to use screen hotkeys or emacs hotkeys. Choose screen. |
Alt + F12 |
Turn mouse support for scrolling on/off |
Here’s a more elaborate cheat sheet.
VIM
To install vim:
sudo apt install vim