DEV Community

Cover image for Enhanced Windows Terminal with Folder Icons
webjoyable
webjoyable

Posted on • Edited on

Enhanced Windows Terminal with Folder Icons

This will be a short tutorial on how to enhance Windows Terminal to make it more appealing and easier to read.

Let's keep it simple.


Install oh-my-posh

Open Windows Terminal, access PowerShell profile, and enter these lines



Install-Module oh-my-posh -Scope CurrentUser

// optional
Install-Module posh-git -Scope CurrentUser


Enter fullscreen mode Exit fullscreen mode

I'm using PowerShell v7.2


Install fonts

You can use any of these fonts because they support icons and ligatures used in the themes. I used CaskaydiaCove NF since some of the fonts have wierd lines around the leading and trailing symbols.

NerdFonts


Display installed themes

This will display all official themes with styling, and when you find the one that suits, you have to update $PROFILE script again



Get-PoshThemes


Enter fullscreen mode Exit fullscreen mode

I am using clean-detailed theme so we will just add it's name. Again notepad $PROFILE and append this line



Set-PoshPrompt -Theme clean-detailed


Enter fullscreen mode Exit fullscreen mode

Theme configuration file

All installed theme configuration files are located in %LOCALAPPDATA%\Programs\oh-my-posh\themes, so go there and copy the configuration file of your selected theme, in my case it's clean-detailed.omp.json.

Paste the copied file to ex. C:\omp-config.omp.json and update our shell configuration by entering this in our $PROFILE script



oh-my-posh --init --shell pwsh --config C:\config.omp.json | Invoke-Expression


Enter fullscreen mode Exit fullscreen mode

This will update shell configuration, and after this we need to reload $PROFILE script, so just run this



. $PROFILE


Enter fullscreen mode Exit fullscreen mode

Install icons

If you want folder icons to be visible run this script



Install-Module -Name Terminal-Icons -Repository PSGallery


Enter fullscreen mode Exit fullscreen mode

after this, as usual, we need to update $PROFILE script, so enter notepad $PROFILE powershell to edit and append this to end of the file



Import-Module -Name Terminal-Icons


Enter fullscreen mode Exit fullscreen mode

Final layout

This is our $PROFILE configuration



Import-Module posh-git
Import-Module oh-my-posh
Import-Module Terminal-Icons
Set-PoshPrompt -Theme clean-detailed
oh-my-posh --init --shell pwsh --config C:\config.omp.json | Invoke-Expression


Enter fullscreen mode Exit fullscreen mode

You can basically customize everything from this point, but this is the layout that we got from just entering couple of lines, and I think it's far better than plain Windows Terminal.

Ohmyposh has comprehensive documentation on how and what you can stylize

Final layout

After all this you should be setting this as your default profile in Windows Terminal by editing configuration file as follows



"defaultProfile": "{your-powershell-profile-guid}",
        "defaults": 
        {
            "antialiasingMode": "cleartype",
            "experimental.retroTerminalEffect": false,
            "font": 
            {
                "face": "CaskaydiaCove NF",
                "size": 12,
                "weight": "medium"
            },
            "intenseTextStyle": "bright",
            "padding": "20",
            "snapOnInput": true,
            "startingDirectory": "%__CD__%",
        },


Enter fullscreen mode Exit fullscreen mode

For better experience install PSReadLine module that has a lot of improvement style and accessibility wise



Install-Module PSReadLine -AllowPrerelease -Force


Enter fullscreen mode Exit fullscreen mode

And update profile again, notepad $PROFILE



Import-Module PSReadLine


Enter fullscreen mode Exit fullscreen mode

If you want to use oh-my-posh outside of powershell, you have to add it to $PATH env variable.

Just enter this line



$env:PATH += $env:POSH_PATH


Enter fullscreen mode Exit fullscreen mode

Also, if you want to exclude version and intro text of powershell, just add /nologo in settings GUI or append in powershell profile directly (settings.json):



{
 "commandline": "C:\\Program Files\\PowerShell\\7\\pwsh.exe /nologo", // here
 "guid": "{your-guid}",
 "hidden": false,
 "name": "PowerShell",
 "source": "Windows.Terminal.PowershellCore"
},


Enter fullscreen mode Exit fullscreen mode

Resources

Oh-my-posh docs

Windows Terminal docs

Top comments (1)

Collapse
 
anderssonpeter profile image
Peter

I have started a project that I think would be a great fit (it's not done yet but it is functional)

github.com/AnderssonPeter/PowerType it gives you autocomplete for cli tools, currently it only supports a subset of git.

Would love feedback!