Z shell
August 12 2018236 words, ~2 min. read
linux, freebsd, shell, zsh
- Install as root
# pkg install zsh - Make zsh as default shell using
$ chsh -s zsh - Install oh my zsh
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" - Install Antigen, plugin manager for zsh
# pkg install zsh-antigen. Also,source /usr/local/share/zsh-antigen/antigen.zshin~.zshrc. - Install plugins, themes, etc.
To install zsh-syntax-highlighting and zsh-autosuggestions plugins,
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
Also, ensure to enable these plugins in ~/.zshrc
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
To install powerlevel9k theme,
$ sudo pkg install powerline-fonts
$ git clone https://github.com/bhilburn/powerlevel9k ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel9k
And, ensure to set the theme in ~/.zshrc.
ZSH_THEME="powerlevel9k/powerlevel9k"
Notes
- File name completions
- similar behaviour as of
bash - Directory name completions
- e.g. type
cdand pressTABto loop through the directories available - Path expansions
- e.g. type
cd /u/lo/band pressTABto expand to/usr/local/bin - Path replacements
- e.g. if already in
/usr/local/bindirectory, typecd bin shareto switch to/usr/local/sharedirectory - Command completions
- e.g. within a
gitrepository, typegit stand pressTABto see possible completions likestash,status - Right prompt
- e.g.
export RPS1=%dto see directory names on the right side of the prompt - Normal aliases
- e.g.
alias ec="emacsclient -tc" - Global aliases
- e.g.
alias -g gi="grep -i" - Open-with aliase
- e.g.
alias -s py=ec - Environment edit
- e.g.
vared PATH - Function Hooks
- please refer this page for more details
References
- Why zsh is cooler than your shell
- http://www.leancrew.com/all-this/2011/12/more-shell-less-egg/
- Oh my zsh
- Z shell guide