Post

Setup ZSH, oh-my-zsh and some addons/plugins

Unter Debian 12.6 soll die Shell ZSH mit dem Framework oh-my-zsh, dem fuzzy finder FZF und derm Theme Powerlevel10k installiert werden. Im Anschluss werden die wichtigsten Plugins für das Framework oh-my-ush installiert.

ZSH installieren

Am Anfang wird ZSH für alle Benutzer installiert:

1
2
sudo apt update
sudo apt install zsh -y

Oh-My-Zsh installieren

Im Anschluss wird das Framework Oh-My-Zsh installiert:

1
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Powerlevel10k Theme installieren

Für die Installation des Powerlevel10k Themes müssen folgende Schritte ausgeführt werden:

1
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

Danach muss die Verwendung des Themes in der Datei .zshrc eingetragen werden:

1
sed -i 's/ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc

FZF installieren

Der fuzzy finder FZF wird installiert:

1
2
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

Plugins für Oh-My-Zsh installieren

Die wichtigsten Plugins werden installiert:

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
# Plugin-Verzeichnis erstellen
mkdir -p ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins

# zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# you-should-use
git clone https://github.com/MichaelAquilina/zsh-you-should-use ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/you-should-use

# zsh-bat
git clone https://github.com/fdellwing/zsh-bat.git $ZSH_CUSTOM/plugins/zsh-bat

# fast-syntax-highlighting
git clone https://github.com/zdharma-continuum/fast-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fast-syntax-highlighting

# fzf-tab
git clone https://github.com/Aloxaf/fzf-tab ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab

# zsh-history-substring-search
git clone https://github.com/zsh-users/zsh-history-substring-search ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-history-substring-search

# zsh-autocomplete
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autocomplete

Plugins aktivieren

Um die installierten Plugins zu aktivieren, muss die Datei .zshrc bearbeitet werden:

1
sed -i 's/plugins=(.*)/plugins=(fast-syntax-highlighting sudo fzf-tab docker docker-compose git you-should-use zsh-autosuggestions zsh-bat zsh-syntax-highlighting zsh-history-substring-search web-search z)/' ~/.zshrc

Installation von bat als Ersatz für cat

1
2
3
sudo apt install bat
mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat

Installation von EXA als Erweiterung von ls

1
2
3
sudo apt install exa
touch $ZSH_CUSTOM/aliases.zsh
echo 'alias list="exa -l -a -h -g --octal-permissions"' >> $ZSH_CUSTOM/aliases.zsh

ZSH als Standard-Shell festlegen

1
chsh -s $(which zsh)

Benutzer-Shell aktualisieren

1
sudo usermod -s /usr/bin/zsh <username>

ZSH-Konfiguration für alle (neuen) Benutzer

1
sudo cp ~/.zshrc /etc/skel/.zshrc

System aktualisieren und abschliessen

1
2
sudo apt upgrade -y
source ~/.zshrc
This post is licensed under CC BY 4.0 by the author.

Trending Tags