For an awesome programming experience, customizing the working environment is the most wanted thing for a programmer. For that reason, every IDE provides different themes. But those, who work using the Windows PowerShell terminal, oh-my-posh and posh-git (recommended for Git users) are definitely the right and easy choice.
oh-my-posh is a PowerShell module that helps to decorate our PowerShell window using different in-built and self-customized themes. posh-git is a PowerShell module that integrates Git and PowerShell by providing _Git status summary informatio_n that can be displayed in the PowerShell prompt, e.g. โ posh-git also provides tab completion support for common git commands, branch names, paths and more. However, those who donโt use Git can use only oh-my-gish for their customised terminal window for a lovely attractive working environment.
๐๐๐๐๐๐ :๐๐ผ๐๐โโโโฆ ๐ค๐-๐ข๐ฎ-๐ฅ๐ค๐จ๐ ๐๐ ๐๐จ ๐๐ช๐ฉ. ๐๐ก๐๐๐จ๐ ๐๐๐๐ ๐๐ฎ ๐๐๐ฉ๐๐จ๐ฉ ๐ผ๐ง๐ฉ๐๐๐ก๐ ๐ค๐ฃ ๐ฉ๐๐ ๐ค๐-๐ข๐ฎ-๐ฅ๐ค๐จ๐ ๐๐ค๐๐ช๐ก๐ ๐๐จ๐๐ฃ๐ ๐ฉ๐๐ ๐๐ค๐ก๐ก๐ค๐ฌ๐๐ฃ๐ ๐๐๐ฃ๐ . ๐๐๐๐ฃ ๐พ๐ค๐ข๐ ๐ฝ๐๐๐ ๐ผ๐๐๐๐ฃ ๐๐ค๐ง ๐๐๐ ๐ฅ๐ค๐จ๐-๐๐๐ฉ ๐๐๐ง๐ฉ.
โ โ โ
Requirements
Basically, we donโt need any extra type of tool for installing these modules. The only two requirements are โ
- โข Windows PowerShell
- โข Administrator Mode
Process
Step 1: Installation of modules:
This step is mainly divided into two parts, (1) Installation of oh-my-posh, (2) installation of posh-git. For both installations, Iโm giving two possible methods using a simple line of command or manually. For beginners, Iโll recommend them for going with the command line procedure. Now, if you are not a programmer or donโt use Git, then you donโt need to install posh-git. If you use Git, then Iโll highly recommend you for installing posh-git.
(1) Installation of oh-my-posh:
For installing oh-my-posh one can type the following code in the PowerShell terminal window,
One can also install it manually from the following URL,
While installation computer can ask you permission for installing a higher version of NuGet. One can simply press enter (default selection is โyesโ) or can type โyโ and then press enter. Then, one has to give another permission for installing modules from an untrusted repository. Donโt worry, itโll not affect your computer. Simply type โyโ and press enter for installation (please be sure here you have to write โyโ as the default selection is โnโ for this process)[Figure 1].
[2] Installation of posh-git:
For installing posh-git one has to type the following line of code in the PowerShell terminal window,
Another way of installation is a manual one. For that, one needs to use the following URL โ
For this installation also, one has to permit installing modules from an untrusted repository. Simply type โyโ and press enter for installation (please be sure here you have to write โyโ as the default selection is โnโ for this process)[Figure 1.2].
Step 2: Setting some cool fonts:
Now, letโs download some cool fonts for our PowerShell which windows supported. For that, one has to perform the following several steps โ
[1] Typing the following one-line command in the PowerShell terminal window,
[2] The above command downloads different fonts supported by Windows PowerShell in zip format. The next step is extracting the fonts from the zip file by typing the following command in the terminal โ
[3] Now we have to install all the fonts by using the following command โ
Now, probably youโll get an error like shown in Figure 3,
Now, one will have to tell the Execution Policy for moving forward. We will need to set to Execution Policy to Bypass, so that we may run this script. So, we have to type Set-ExecutionPolicy Bypass in the terminal and run the .\powerlinefonts\fonts-master\install.ps1 command again. Now, one will be able to see a window showing โInstalling Fontsโ [Figure 4] โ
[4] now we can clean up the downloaded zip file using two following commands โ
[5] The last step is setting the font for PowerShell. Right-click on the PowerShell window top-bar for more options, go to Properties and then to Font. Select any font from the available options and click OK [Figure 5].
Figure 5: Setting the font from PowerShell console
Step 3: Importing modules and setting theme:
After setting the font, we have to import the two modules using the following commands โ
As you are all set up, you can see all the themes using the get-theme command [Figure 6].
Now, you can set any theme as you like using the set-theme [theme-name] command like following,
But till now this theme is not set yet as permanent. For that, type the following two commands in the terminal โ
Now, itโll open a notepad window. Please add these 3 lines to the file and save it.
These will set the Agnoster theme permanently for Windows PowerShell.
Step 4: Setting execution policy to default:
After setting the theme successfully set your execution policy to default by using the following command โ
โ โ โ
Itโs all set up. But if you want to set your background colour and also the other colours of the theme manually (other than colours provided by PowerShell), there is a secret procedure. For that, you have to download the Dracula Theme for PowerShell from here after doing all the previous steps. Unzip the folder, navigate to inside the folder ColoTool and run install.cmd. Now your terminal should look like Figure 7,
Now close the PowerShell window and start again. This time the PowerShell window should look like Figure 8 โ
If you want to set your colour, then do the necessary changes in RGB colour percentages in Dracula-ColorTool.itermcolors file situated inside the install folder under the ColorTool folder.
After setting your favourite colour, please again set the font as itโll be unset after installing the Dracula theme. Have fun with your customized PowerShell terminal.
Note
- โข All available fonts do not work properly in the terminal. Sometimes you can see unsupported signs (e.g. โ git sign etc.). If you encounter such type of error, please set a different font using trial and error method. Youโll be all set.
- โข You must do all the operations in Administrator Mode. Otherwise, youโll end up with thousands of errors.
References
- โข How to install powerline fonts in windows (Medium)
- โข Spice up your powershell prompt (YouTube)
- โข posh-git
- โข oh-my-posh
- โข Dracula theme
โ โ โ