Zsh Installation / Ubuntu, macOS Environment

Zsh Installation / Ubuntu, macOS Environment

1. Zsh Installation

1.1. Ubuntu

$ apt install zsh
$ curl -L http://install.ohmyz.sh | sh
$ chsh -s `which zsh`
$ zsh

Install zsh and oh-my-zsh and set the default shell to Zsh. Proceed from Zsh afterwards.

1.2. macOS

$ brew install zsh zsh-completions
$ curl -L http://install.ohmyz.sh | sh
$ which zsh >> /etc/shells
$ chsh -s `which zsh`
$ zsh

Install zsh, zsh-completions, and oh-my-zsh and set the default shell to Zsh. Proceed from Zsh afterwards.

2. Zsh Plugin Download

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
$ git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-completions $ZSH_CUSTOM/plugins/zsh-completions

Install zsh-syntax-highlighting, zsh-autosuggestions, and zsh-completions.

3. Zsh Plugin Configuration

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
...
plugins=(
  git
  docker
  kubectl
  kubectx
  zsh-completions
  zsh-autosuggestions
  zsh-syntax-highlighting
)

source $ZSH/oh-my-zsh.sh
...
# Prompt
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
PROMPT+='%{$fg_bold[blue]%}k8s:(%{$fg[red]%}$(kubectx_prompt_info)%{$fg_bold[blue]%})%{$reset_color%} ' # k8s context
[File 1] ~/.zshrc

Modify the ~/.zshrc file with the content from [File 1] to configure plugins.

4. References