Articles

Terminal Setup

Filip Fog | 2022-06-19

Terminal
Guide

One way of setting up the terminal on windows or linux., with the preferred shell as zsh.

Terminal Settings

Linux - ZSH

1. Install oh-my-zsh

sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

2. Clone necessary plugins.

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

3. Add plugins to ~/.zshrc

plugins = ( [plugins...] zsh-autosuggestions history-substring-search zsh-syntax-highlighting)

Note: make sure zsh-syntax-highlighting is the last one in the above list.

Change the theme setting in ~/.zshrc

ZSH_THEME="jonathan"

Find a theme you like in this list: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes

Fix background theme issues(, not necessary depends on your theme.)

Add the following line to your ~/.zshrc.

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=white'

4. Restart zsh

source ~/.zshrc

Windows - Powershell

1. Get the latest powershell version

winget search Microsoft.PowerShell

winget install --id Microsoft.Powershell --source winget
# or
winget install --id Microsoft.Powershell.Preview --source winget

2. Update Windows Terminal (optional)

Start the new powershell with pwsh.exe. If you are using Windows Terminal you need to update the settings for powershell. Terminal Settings

3. Enable auto-suggestions

To enable auto suggestions use the following command

Set-PSReadLineOption -PredictionSource History

Update terminal profile (optional)

Create profile file.

(Test-path $profile) -eq $False ? (New-item –type file –force $profile) : (Write-Host "Profile already exists!")

Open it with notepad, notepad $profile, and add the following lines:

Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -Colors @{ InlinePrediction = "$([char]0x1b)[36;7;238m"}

source: Predictive Intellisense