<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Diego </title>
    <description>The latest articles on DEV Community by Diego  (@dialguiba).</description>
    <link>https://dev.to/dialguiba</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F327170%2Fc77711b5-3c22-4b08-8014-2d5a67c59284.jpg</url>
      <title>DEV Community: Diego </title>
      <link>https://dev.to/dialguiba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dialguiba"/>
    <language>en</language>
    <item>
      <title>My powershell configuration</title>
      <dc:creator>Diego </dc:creator>
      <pubDate>Wed, 18 Nov 2020 16:57:03 +0000</pubDate>
      <link>https://dev.to/dialguiba/my-powershell-configuration-55de</link>
      <guid>https://dev.to/dialguiba/my-powershell-configuration-55de</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Preview&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;At the end of this guide your terminal will be like this.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fpreview.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fpreview.jpg" alt="preview"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Index&lt;/strong&gt;
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
Installing Windows Terminal (Optional)&lt;/li&gt;
&lt;li&gt;Installing or Updating Powershell&lt;/li&gt;
&lt;li&gt;Installing OhMyZsh for Windows OhMyPosh&lt;/li&gt;
&lt;li&gt;Installing and Configuring Fonts&lt;/li&gt;
&lt;li&gt;Enabling Sudo Command&lt;/li&gt;
&lt;li&gt;Installing module for icons&lt;/li&gt;
&lt;li&gt;Some color personalization for Readline&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Installing Windows Terminal&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;First of all, I recommend you install Windows terminal that could will allow you personalize your terminal even more. You can download it from the microsoft store.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtab" rel="noopener noreferrer"&gt;Download Windows Terminal&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Installing or Updating Powershell&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;(This is not strictly necessary but i recommend you install it if you can so you wouldnt have problems with any step)&lt;br&gt;
Install the last version of powershell. You can download it from here. Remember that this version is going to replace the powershell 6 if you have installed it. (Does not affect powershell version 5)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/PowerShell/PowerShell/releases" rel="noopener noreferrer"&gt;Download Powershell 7&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Installing OhMyZsh for windows OhMyPosh&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;You need to use the PowerShell Gallery to install oh-my-posh. (Refered: &lt;a href="https://github.com/JanDeDobbeleer/oh-my-posh" rel="noopener noreferrer"&gt;https://github.com/JanDeDobbeleer/oh-my-posh&lt;/a&gt;) You can see the themes available there. But take into account that some themes dont have the same names that appear in the repository.&lt;/p&gt;

&lt;p&gt;Install posh-git and oh-my-posh:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable the prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Start the default settings
Set-Prompt
# Alternatively set the desired theme:
Set-Theme Agnoster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In case you're running this on PS Core, make sure to also install version 2.0.0-beta1 of PSReadLine&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To enable the engine edit your PowerShell profile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the file opened copy these lines so next times you open terminal it will load the modules and theme&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Paradox
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some Useful Commands:&lt;/p&gt;

&lt;p&gt;To see what are your actual settings:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ThemeSettings&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you want to open the file that define your profile in powershell.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$profile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It gives you the path of your configuration profile path. You can open it with the command notepad or code if you have visual studio code.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;notepad $profile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To see what are the names of the available themes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;get-theme&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you want to test some themes temporaly you can use the command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Set-Theme NameofTheTheme&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To see what are the actual colors of your theme:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Show-ThemeColors&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To see what are the colors available that you can use:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Show-Colors&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Remember that when you choose a theme and want to see it every time you start powersheel you have to define it in your profile file using&lt;/p&gt;

&lt;p&gt;&lt;code&gt;notepad $profile&lt;/code&gt;&lt;br&gt;
Set-Theme NameOfTheme&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Installing and Configuring Fonts&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;If you dont install the fonts you probably will see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fnofonts.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fnofonts.jpg" alt="nofonts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, you should install a font that includes glyphs. Two of them are Cascadia Code PL or MeslolGS NF&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/romkatv/dotfiles-public/blob/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Regular.ttf" rel="noopener noreferrer"&gt;MesloLGS NF Regular&lt;/a&gt;&lt;br&gt;
You can install it with double click&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/microsoft/cascadia-code/releases" rel="noopener noreferrer"&gt;Cascadia Code&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, to set the fonts in terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Ffontscommandterminal.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Ffontscommandterminal.jpg" alt="configterminalfonts"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;in that configuration file oyu have to add configuration for you default profile or specifically for your powershell 7&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fconfigscommand.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fconfigscommand.jpg" alt="configscommand"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, If you have want to use that version of powershell and set that font in vscode to use it in the terminal you could do this.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pwshell as default shell&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fdefaultshell1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fdefaultshell1.jpg" alt="defaultshell1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the version 7 of powershell&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fdefaultshell2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Fdialguiba%2FPowerShellConfiguration%2Fraw%2Fmaster%2Fimages%2Fdefaultshell2.jpg" alt="defaultshell2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;add this lines in settings.json&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;"terminal.integrated.fontFamily": "MesloLGS NF"&lt;/code&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Enabling Sudo Command&lt;/strong&gt; (Optional)
&lt;/h1&gt;

&lt;p&gt;Also if you want to have the sudo command like in linux you should download an executable and save it in a folder in your pc and then add that folder in your environment variables path. (You can save that file in c:/Windows folder too. Taking advantage that it is in the environmental variable path) Well, this is optional, you always can change properties of powershell to force it open as administrador always. But, this would be necessary for you if you want to execute something as administrator in ps6 when you are coding in vscode. (You can solve that just open it as administrator too. haha.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/dialguiba/PowerShellConfiguration/blob/master/sudo.rar" rel="noopener noreferrer"&gt;Sudo command&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  &lt;strong&gt;Installing module for icons&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;(Referred: &lt;a href="https://github.com/devblackops/Terminal-Icons" rel="noopener noreferrer"&gt;https://github.com/devblackops/Terminal-Icons&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;To install the module from the PowerShell Gallery:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Install-Module -Name Terminal-Icons -Repository PSGallery&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To use it modify your profile file adding this line:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Import-Module -Name Terminal-Icons&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: Take into account that this module can make it take a bit longer to start powershell.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can see your file with icons using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Get-ChildItem | Format-List

Get-ChildItem | Format-Wide

Get-ChildItem | Format-Wide -Column 3

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Aditionally, if you want to use ls and la commands in powershell so you can see your files with icons easily you could add these lines in your profile file&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#ALIAS

Set-Alias -Name l -value Get-ChildItem
Set-Alias -Name ls -value lsformatwide
Set-Alias -Name lsl -value lsformatlist

#FUNCIONES

function lsformatwide {
    Param(
        [switch]$la
    )

    if ($la) {
        Get-ChildItem $Args[0]. -Force  | Format-Wide -Column 3
    }
    else {
        Get-ChildItem $Args[0] | Format-Wide -Column 3
    }
}
function lsformatlist {
    Get-ChildItem | Format-List
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Now you can use l,ls,lsl to get different views of your files. Also if you want to see hidden files you can use -la after ls&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Some color personalization for Readline&lt;/strong&gt;
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Some color personalization for Readline
&lt;/h1&gt;

&lt;p&gt;I have additional configuration for colorising the readline words adding these lines in my profile.ps1&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Set-PSReadLineOption -Colors @{
    Command            = 'Magenta'
    Number             = 'DarkGray'
    Member             = 'DarkGray'
    Operator           = 'DarkMagenta'
    Type               = 'DarkCyan'
    Variable           = 'Green'
    Parameter          = 'DarkGreen'
    ContinuationPrompt = 'DarkGray'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;*&lt;em&gt;If you want to use the theme with the modifications i did you can download it from here: 
&lt;a href="https://github.com/dialguiba/PowerShellConfiguration/blob/master/Powerlevel10k-Classic-Dialguiba.psm1" rel="noopener noreferrer"&gt;https://github.com/dialguiba/PowerShellConfiguration/blob/master/Powerlevel10k-Classic-Dialguiba.psm1&lt;/a&gt;
*&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>powershell</category>
      <category>themes</category>
      <category>plugins</category>
      <category>ohmyposh</category>
    </item>
  </channel>
</rss>
