Ga naar inhoud

⚑️ Workflow: Zsh installeren en configureren met Zim

Deze gids helpt je bij het installeren van Zsh, het instellen als standaard shell, en het configureren met Zim (een snel en eenvoudig Zsh-framework met thema’s en modules).


ℹ️ Wat is Zsh?

Zsh (Z Shell) is een uitgebreide shell voor Unix/Linux en macOS. Het is een alternatief voor de standaard Bash-shell en biedt meer functionaliteiten zoals:

  • betere tab-completion
  • spelling/autocorrect
  • handige prompt-tweaks
  • krachtige scripting mogelijkheden
  • thema’s en plugins

Zsh is populair in combinatie met frameworks (zoals Oh My Zsh of Zim) die het nog krachtiger en gebruiksvriendelijker maken.


ℹ️ Wat is Zim?

Zim is een lichtgewicht, snel framework voor Zsh.
Het zorgt ervoor dat je gemakkelijk:

  • thema’s kunt instellen voor je prompt
  • modules (plugins) kunt activeren, zoals syntax highlighting, autosuggestions en history search
  • je shell eenvoudig kunt uitbreiden zonder zelf scripts te beheren

πŸ‘‰ Kortom: Zsh = de shell, en Zim = het framework om Zsh uit te breiden.

πŸ”Ή 1. Installeer Zsh

Op Ubuntu/Debian:

sudo apt install zsh

Op macOS (via Homebrew):

brew install zsh

πŸ”Ή 2. Start Zsh

Je kunt direct in Zsh starten met:

zsh

πŸ”Ή 3. Installeer Zim

Gebruik curl om Zim te installeren:

curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh

Na installatie zie je dat er automatisch een default thema is ingesteld.


πŸ”Ή 4. Zet Zsh als standaard shell

Wijzig de standaard shell van je gebruiker:

chsh -s $(which zsh)

Controleer of dit gelukt is met:

cat /etc/passwd | grep jouwgebruikersnaam

Voorbeeld output:

johndoe:x:1001:1001::/home/johndoe:/usr/bin/zsh

Daarmee is bevestigd dat de login-shell nu zsh is.


πŸ”Ή 5. Configuratie in ~/.zimrc

Open het configuratiebestand:

nano ~/.zimrc

Voeg je modules en thema toe na de regel:

zmodule completion

Bijvoorbeeld:

zmodule completion
zmodule prompt
zmodule syntax-highlighting
zmodule autosuggestions
zmodule history-substring-search

πŸ”Ή 6. Modules installeren

Installeer de gekozen modules:

zimfw install

Voorbeeld output:

Installing modules...
Done with installation!

Herstart daarna je terminal. Je ziet nu dat alle modules en het thema actief zijn.


πŸ”Ή 7. Autocorrectie instellen

Open ~/.zshrc:

nano ~/.zshrc

Zoek de regel:

# setopt CORRECT

Verwijder het # en zorg dat er staat:

setopt CORRECT

Sla op en sluit af.


πŸ”Ή 8. Werking van autocorrect

Typ je een fout commando, dan zie je:

zsh: correct 'gti' to 'git' [nyae]?
  • y β†’ Voert het correcte commando uit.
  • n of Enter β†’ Laat de fout staan.

βœ… Samenvatting

  • Installeren Zsh: sudo apt install zsh of brew install zsh
  • Starten: zsh
  • Zim installeren: curl ... | zsh
  • Default shell: chsh -s $(which zsh) β†’ check met /etc/passwd
  • Modules toevoegen: in ~/.zimrc
  • Modules installeren: zimfw install
  • Autocorrect activeren: setopt CORRECT in ~/.zshrc