Forked from jchandra74/PowerShell Customization.md
Created
December 20, 2021 18:15
-
-
Save rjjaramillo/3cbd962bc868695bd10b78d7921960a7 to your computer and use it in GitHub Desktop.
Revisions
-
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Pimping Up Your PowerShell & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts ## Backstory (_TLDR_) -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -183,6 +183,13 @@ _In the figure about I am using an alias l which I bind to <code>Get-ChildItemCo Posh-Git (PowerShell Git) will provide you with additional information on your PowerShell prompt when you are in a directory that has been designated as a local git repository. Prior to installing these module, run the followings: ```PowerShell Install-PackageProvider NuGet -MinimumVersion '2.8.5.201' -Force Set-PSRepository -Name PSGallery -InstallationPolicy Trusted Install-Module -Name 'posh-git' ``` To install it, run the following from PowerShell: ```PowerShell Install-Module -Name 'posh-git' -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -211,7 +211,7 @@ If you've done everything correctly, your PowerShell prompt should like somethin If something is off, like you are seeing weird characters, etc. It is probably due to you misconfiguring the Powerline font inside Cmder setting. If so, revisit the section above to configure it. If you don't like the **agnoster** theme, you can set it to something else. Visit the [Oh-My-Posh](https://github.com/JanJoris/oh-my-posh) GitHub repository to see what other themes are available and additional instructions. ## Get-ChildItemColor Customization -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -148,7 +148,7 @@ To change that selected task contents, you can do it from the Tasks tab like the  ### ConEmu Theme Configuration I am using one of the default themes that comes with ConEmu / Cmder which is **Twilight**.  -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -119,7 +119,7 @@ I like the animation speed set to **150** milliseconds since it is a bit snappie ### PowerShell as Default Task Setup To set PowerShell as your default task when you open Cmder, ensure that it is set as Specified named task as per figure below.  -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -107,7 +107,7 @@ Try different fonts yourself and see which one you like. Just remember that you  Pay attention that I also highlighted the **ConEmu.xml** location in the Storage field. You will need this location later when we customize the ConEmu Theme. _It's not necessary but it's a nice to have. Also, yours might be located in a different directory than mine since I installed Cmder manually previously._ ### Quake Style Setup -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -101,7 +101,7 @@ _From this point onward, you can switch to Cmder and do the rest from there._ Open up Cmder Settings dialog (**Win+Alt+P** when Cmder window is active) and ensure that one of the Powerline fonts is used for both **Main console font** and **Alternative font** as shown below. The Alternative font is needed for showing the correct icons for git on the PowerShell prompt. Here I am using the **Meslo LG M for Powerline** font which I think looks quite nice. I tried using **Ubuntu Mono for Powerline**, but for some reason, it messed up my icons. Try different fonts yourself and see which one you like. Just remember that you will need to choose the font that has been patched for Powerline, otherwise you Git icons might not show correctly. -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -99,7 +99,7 @@ _From this point onward, you can switch to Cmder and do the rest from there._ ### Powerline Font Setup Open up Cmder Settings dialog (**Win+Alt+P** when Cmder window is active) and ensure that one of the Powerline fonts is used for both **Main console font** and **Alternative font** as shown below. The Alternative font is needed for showing the correct icons for git on the PowerShell prompt. Here I am using the **Meslo LG M for Powerline** font which I think look quite nice. I tried using **Ubuntu Mono for Powerline**, but for some reason, it messed up my icons. -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ## Backstory (_TLDR_) I work as a full-stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization. For my console needs, I am using [**Cmder**](http://cmder.net/) which is based on [**ConEmu**](http://conemu.github.io/) with [**PowerShell**](https://msdn.microsoft.com/en-us/powershell/mt173057.aspx) as my shell of choice. -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Pimping Up Your PowerLine & Cmder with Posh-Git, Oh-My-Posh, & Powerline Fonts ## Backstory (_TLDR_) @@ -288,6 +288,10 @@ Set-Theme agnoster _The comments above should be self-explanatory._ ## Done That's it. You should now have a pimped up PowerShell in Cmder that will let you know what's going on with the current git repository, a nicer prompt and fully colorized. Enjoy! ## Testing if Powerline is correctly installed in Cmder 1. Add the following function (stole from [Michael Naumov](https://mnaoumov.wordpress.com/about/)) to your powerline $PROFILE. To edit your $PROFILE, just run <code>ise $PROFILE</code> from within PowerShell: -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -322,7 +322,7 @@ Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26 You should see something like the second line in the figure below:  If you don't see the symbols, please make sure you did the Powerline font installation and Cmder customization as described in the related section above. ## References - [Matthew Hodgkins: Ultimate PowerShell Prompt Customization and Git Setup Guide](https://hodgkins.io/ultimate-powershell-prompt-and-git-setup) -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Nice Windows PowerShell Command Line Environment Setup with Cmder, PowerShell, Posh-Git, Oh-My-Posh, & Powerline Fonts ## Backstory (_TLDR_) @@ -10,8 +10,12 @@ _Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which a For source control, I use **git** for my spikes since our main source control at work is still using hosted TFS on [Visual Studio Team Services](https://www.visualstudio.com/vso/). ### VS Code My editor of choice nowadays is [**VS Code**](https://code.visualstudio.com/) which is lightweight, customizable and all around a good environment to do development for [AngularJS](https://angularjs.org), [Angular](https://angular.io), [NodeJS](https://nodejs.org) and other spikings in general. I've also done some [.NET Core](http://www.microsoft.com/net/core) developments on the editor which is supported quite well including debugging if you follow that style of development. VS Code customization is a large topic by itself, so I won't be writing about it here... Perhaps some other time... _If you want to be on the cutting edge, you can try [Visual Studio Code Insider](https://code.visualstudio.com/insiders). From my experience so far, it is pretty stable and is my VS Code environment of late._ For now, we'll focus on customizing Cmder, Powershell with git, posh-git, oh-my-posh and the Powerline fonts, specifically on how I setup mine which will net you something like the figure below.  -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -207,6 +207,8 @@ If you've done everything correctly, your PowerShell prompt should like somethin If something is off, like you are seeing weird characters, etc. It is probably due to you misconfiguring the Powerline font inside Cmder setting. If so, revisit the section above to configure it. If you don't like the **agnoster** theme, you can set it to something else. Visit the [Oh-My-Posh](https://github.com/JanJoris/oh-my-posh) github repository to see what other themes are available and additional instructions. ## Get-ChildItemColor Customization The following customization will colorize the directory listing. @@ -322,4 +324,5 @@ If you don't see the symbols, please make sure you did the Powerline font instal - [Matthew Hodgkins: Ultimate PowerShell Prompt Customization and Git Setup Guide](https://hodgkins.io/ultimate-powershell-prompt-and-git-setup) - [Michael Naumov: Unicode Literals in PowerShell](https://mnaoumov.wordpress.com/2014/06/14/unicode-literals-in-powershell/) - [Joon Ro: Get-ChildItemColor Github repository](https://github.com/joonro/Get-ChildItemColor) - [Oh-My-Posh github repository](https://github.com/JanJoris/oh-my-posh) - [agnoster Readme](https://gist.github.com/agnoster/3712874) -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -280,6 +280,8 @@ Import-Module -Name oh-my-posh Set-Theme agnoster ``` _The comments above should be self-explanatory._ ## Testing if Powerline is correctly installed in Cmder 1. Add the following function (stole from [Michael Naumov](https://mnaoumov.wordpress.com/about/)) to your powerline $PROFILE. To edit your $PROFILE, just run <code>ise $PROFILE</code> from within PowerShell: -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 125 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -143,7 +143,37 @@ To change that selected task contents, you can do it from the Tasks tab like the  ### ConEmu Theme Configuration I am using one of the default theme that comes w/ ConEmu / Cmder which is **Twilight**.  If you want to add other themes, you can clone the following git repository: [https://github.com/joonro/ConEmu-Color-Themes](https://github.com/joonro/ConEmu-Color-Themes) and follow his instruction on **How To Install** it. As I mentioned previously, pay attention to the **Storage** field setting in the figure above. You need to replace the <code>-ConfigPath</code> value to that particular ConEmu.xml location. To clone the repository do: ```PowerShell git clone https://github.com/joonro/ConEmu-Color-Themes.git ``` Afterward, go to the tools directory like shown below: ```PowerShell cd .\ConEmu-Color-Themes\tool ```  And run the script to install a particular theme. The theme is located outside the tool directory.  ```PowerShell .\Install-ConEmuTheme.ps1 -ConfigPath C:\Users\jimmy\Downloads\cmder\vendor\conemu-maximus5\ConEmu.xml -Operation Add -ThemePathOrName ..\oceans16-dark.xml ``` _In the figure about I am using an alias l which I bind to <code>Get-ChildItemColorFormatWide</code> from [this](https://github.com/joonro/Get-ChildItemColor) git repository. Don't worry if you don't have it. Just do <code>ls</code> for now. I'll show you how to install that cmdlet a bit later._ ## Install Posh-Git and Oh-My-Posh @@ -154,13 +184,103 @@ To install it, run the following from PowerShell: Install-Module -Name 'posh-git' ``` Oh-My-Posh will let you theme your PowerShell prompt. To install it, run the following from PowerShell: ```PowerShell Install-Module -Name 'oh-my-posh' ``` _If PowerShell complains that you cannot do this, the most likely problem is that you do not have PowerShell v5 and PowerShellGet is not installed correctly. Revisit the step to do this above if that is the case._ To test the new Oh-My-Posh, do the followings from inside PowerShell: ```PowerShell Import-Module 'posh-git' Import-Module 'oh-my-posh' Set-Theme agnoster ``` If you've done everything correctly, your PowerShell prompt should like something like the figure below.  If something is off, like you are seeing weird characters, etc. It is probably due to you misconfiguring the Powerline font inside Cmder setting. If so, revisit the section above to configure it. ## Get-ChildItemColor Customization The following customization will colorize the directory listing. To install Get-ChildItemColor, simply run the following in PowerShell. ```PowerShell Install-Module -Name 'Get-ChildItemColor' ``` Once installed, you can use these cmdlet <code>Get-ChildItemColor</code> and <code>Get-ChildItemColorFormatWide</code> to list your directory content and it will colorize files, directory, etc. appropriately. In the next section we will add alias so we can use <code>l</code> and <code>ls</code> as shortcuts to the cmdlet above. ## Configuring the PowerShell $PROFILE Run <code>ise $PROFILE</code> from within PowerShell. This will launch the Integrated Scripting Environment for PowerShell and let you edit your $PROFILE file. Add the following things to that content of the $PROFILE file. ```PowerShell # Ensure that Get-ChildItemColor is loaded Import-Module Get-ChildItemColor # Set l and ls alias to use the new Get-ChildItemColor cmdlets Set-Alias l Get-ChildItemColor -Option AllScope Set-Alias ls Get-ChildItemColorFormatWide -Option AllScope # Helper function to change directory to my development workspace # Change c:\ws to your usual workspace and everytime you type # in cws from PowerShell it will take you directly there. function cws { Set-Location c:\ws } # Helper function to set location to the User Profile directory function cuserprofile { Set-Location ~ } Set-Alias ~ cuserprofile -Option AllScope # Helper function to show Unicode character function U { param ( [int] $Code ) if ((0 -le $Code) -and ($Code -le 0xFFFF)) { return [char] $Code } if ((0x10000 -le $Code) -and ($Code -le 0x10FFFF)) { return [char]::ConvertFromUtf32($Code) } throw "Invalid character code $Code" } # Ensure posh-git is loaded Import-Module -Name posh-git # Start SshAgent if not already # Need this if you are using github as your remote git repository if (! (ps | ? { $_.Name -eq 'ssh-agent'})) { Start-SshAgent } # Ensure oh-my-posh is loaded Import-Module -Name oh-my-posh # Default the prompt to agnoster oh-my-posh theme Set-Theme agnoster ``` ## Testing if Powerline is correctly installed in Cmder 1. Add the following function (stole from [Michael Naumov](https://mnaoumov.wordpress.com/about/)) to your powerline $PROFILE. To edit your $PROFILE, just run <code>ise $PROFILE</code> from within PowerShell: ```PowerShell @@ -187,6 +307,7 @@ function U 2. Run the following script inside PowerShell: ```PowerShell . $PROFILE Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26A1) $(U 0x2699)" ``` @@ -197,6 +318,6 @@ If you don't see the symbols, please make sure you did the Powerline font instal ## References - [Matthew Hodgkins: Ultimate PowerShell Prompt Customization and Git Setup Guide](https://hodgkins.io/ultimate-powershell-prompt-and-git-setup) - [Michael Naumov: Unicode Literals in PowerShell](https://mnaoumov.wordpress.com/2014/06/14/unicode-literals-in-powershell/) - [Joon Ro: Get-ChildItemColor Github repository](https://github.com/joonro/Get-ChildItemColor) - [agnoster Readme](https://gist.github.com/agnoster/3712874) -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 77 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -42,7 +42,7 @@ I use **Chocolatey** as my install manager. To install **Chocolatey**, do the f Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force ``` PowerShell might complain. If so, you probably need to change <code >RemoteSigned</code> to <code>ByPass</code> or <code>Unrestricted</code>. Running <code>Get-ExecutionPolicy</code> from inside PowerShell will tell you what to change it to. Afterward, run the following and wait for it to finish: ```PowerShell @@ -51,9 +51,16 @@ iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex ## Installing Git using Chocolatey If you already have [**git**](https://git-for-windows.github.io/) installed, you can skip this part. If you do not know if git has been installed or not, you can check by typing the following into PowerShell: ```PowerShell git --version ``` If you have it installed, you should see the version of git that has been installed on your system. If it is not installed, run the following to install Git from PowerShell via Chocolatey: ```PowerShell cinst git.install -y ``` @@ -67,14 +74,6 @@ Otherwise, run the following to install Cmder from PowerShell: cinst cmder -y ``` ## Install Powerline Fonts Clone the powerline repository from GitHub. @@ -90,12 +89,76 @@ cd fonts Wait for all the fonts to be installed. _From this point onward, you can switch to Cmder and do the rest from there._ ## Cmder Customization ### Powerline Font Setup Open up Cmder Settings dialog (**Win+Alt+P** when Cmder window is active) and ensure that one of the Powerline font is used for both **Main console font** and **Alternative font** as shown below. The Alternative font is needed for showing the correct icons for git on the PowerShell prompt. Here I am using the **Meslo LG M for Powerline** font which I think look quite nice. I tried using **Ubuntu Mono for Powerline**, but for some reason, it messed up my icons. Try different fonts yourself and see which one you like. Just remember that you will need to choose the font that has been patched for Powerline, otherwise you Git icons might not show correctly.  Pay attention that I also highlighted the **ConEmu.xml** location in the Storage field. You will need this location later when we customize the ConEmu Theme. _It's not necessary but it's a nice to have. Also, yours might be located on a different directory than mine since I installed Cmder manually previously._ ### Quake Style Setup Another thing that you might want to customize is to put Cmder into Quake style where you can show and hide it using **Ctrl+~** key. To do that set the Quake mode setting to something like this:  I like the animation speed set to **150** milliseconds since it is a bit snappier than the default **300** milliseconds. ### PowerShell as Default Task Setup To set PowerShell as your default task whn you open Cmder, ensure that it is set as Specified named task as per figure below.  _Take note of the **profile.ps1** location above inside the Selected contents section. I already changed this to the **$PROFILE** variable from inside PowerShell. By default, Cmder is pointing to its own profile.ps1 location. If you don't change this, your PowerShell profile customization that we will do later will not be loaded automatically upon launching Cmder or any new PowerShell task tab inside Cmder._ To check where your own PowerShell profile location, you can type **$PROFILE** inside PowerShell.  _If you are not familiar with Windows, **%USERPROFILE%** is equivalent to **C:\Users\username** (which is the default user profile location in Windows, unless you have moved it somewhere else)._ _Also, you might have this file already or not. It does not matter. We'll create one or edit existing one later. The important thing here is that you need to point the PowerShell task to the right location or your profile customization will not load automatically and you will have to load it manually by typing the following into PowerShell:_ ```PowerShell . $PROFILE ``` _It's the equivalent of <code>source .bashrc</code> or <code>source .zshrc</code>, etc. if you are familiar with Linux. In any case, it is a nice thing to remember when you further customize your $PROFILE. To customize your profile you can run <code>ise $PROFILE</code> from PowerShell. _Again, we will do this later, don't bother with it now._ To change that selected task contents, you can do it from the Tasks tab like the figure below. Ensure that you change both PowerShell and PowerShell as Admin.  ## Install Posh-Git and Oh-My-Posh Posh-Git (PowerShell Git) will provide you with additional information on your PowerShell prompt when you are in a directory that has been designated as a local git repository. To install it, run the following from PowerShell: ```PowerShell Install-Module -Name 'posh-git' ``` Oh-My-Posh will let you theme your PowerShell prompt ```PowerShell Set-Theme agnoster ``` ## How to test if Powerline is correctly installed in Cmder / ConEmu: -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,18 @@ If you are already on **Windows 10**, you can skip this section. If not, you will need to make sure you have **PowerShellGet** installed. We will use it to pull PS Modules from PS Gallery. Instruction on how to get **PowerShellGet** can be found [here](https://msdn.microsoft.com/powershell/gallery/readme). Upgrading to PowerShell v5 is preferable since it comes with PowerShellGet. The **Get WMF 5** route from the link above will do this for you. Just make sure to download the right version for you OS. I.e. if you are on Win2K8R2, choose **Win8.1AndW2K12R2-KB3134758-x64.msu** from the Download list, etc. You can check your PowerShell version by typing the following from within PowerShell. ```PowerShell $host.Version ``` ## Installing Chocolatey Start PowerShell using **Run As Administrator** option. We might need it until we get everything installed. I use **Chocolatey** as my install manager. To install **Chocolatey**, do the following from within **PowerShell**: ```PowerShell -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -88,7 +88,7 @@ Also make sure you set the same font for the Alternative font to use, otherwise ## How to test if Powerline is correctly installed in Cmder / ConEmu: 1. Add the following function (stole from [Michael Naumov](https://mnaoumov.wordpress.com/about/)) to your powerline $PROFILE. To edit your $PROFILE, just run <code>ise $PROFILE</code> from within PowerShell: ```PowerShell function U { -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -124,4 +124,5 @@ If you don't see the symbols, please make sure you did the Powerline font instal ## References - [Matthew Hodgkins: Ultimate PowerShell Prompt Customization and Git Setup Guide](https://hodgkins.io/ultimate-powershell-prompt-and-git-setup) - [agnoster Readme](https://gist.github.com/agnoster/3712874) - [Unicode Literals in PowerShell](https://mnaoumov.wordpress.com/2014/06/14/unicode-literals-in-powershell/) -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -117,11 +117,11 @@ Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26 ``` You should see something like the second line in the figure below:  If you don't see the symbols, please make sure you did the Powerline font installation and Cmder customization as described in section 2. ## References - [Matthew Hodgkins: Ultimate PowerShell Prompt Customization and Git Setup Guide](https://hodgkins.io/ultimate-powershell-prompt-and-git-setup) - [agnoster Readme](https://gist.github.com/agnoster/3712874) -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ My editor of choice nowadays is [**VS Code**](https://code.visualstudio.com/) wh For now, we'll focus on customizing Cmder, Powershell with git, posh-git, oh-my-posh and the Powerline fonts, specifically on how I setup mine which will net you something like the figure below.  A lot of people has written up about customizing PowerShell but I can only find bits and pieces. This article hopefully will combine those bits and pieces into a more coherent end-to-end story. -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,9 +10,11 @@ _Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which a For source control, I use **git** for my spikes since our main source control at work is still using hosted TFS on [Visual Studio Team Services](https://www.visualstudio.com/vso/). My editor of choice nowadays is [**VS Code**](https://code.visualstudio.com/) which is lightweight, customizable and all around a good environment to do development for [AngularJS](https://angularjs.org), [Angular](https://angular.io), [NodeJS](https://nodejs.org) and other spikings in general. I've also done some [.NET Core](http://www.microsoft.com/net/core) developments on the editor which is supported quite well including debugging if you follow that style of development. VS Code customization is a large topic by itself, so I won't be writing about it here... Perhaps some other time... For now, we'll focus on customizing Cmder, Powershell with git, posh-git, oh-my-posh and the Powerline fonts, specifically on how I setup mine which will net you something like the figure below. ![Customized Cmder PowerShell with Oh-My-Posh agnoster theme]() A lot of people has written up about customizing PowerShell but I can only find bits and pieces. This article hopefully will combine those bits and pieces into a more coherent end-to-end story. -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 49 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +1,58 @@ # Nice Front-End / Node Development Environment on Windows 10 Setup with VS Code, Cmder, PowerShell, Posh-Git, Oh-My-Posh, and Powerline Fonts ## Backstory (_TLDR_) I work as a full stack developer at work. We are a Windows & Azure shop, so we are using Windows as our development platform, hence this customization. For my console needs, I am using [**Cmder**](http://cmder.net/) which is based on [**ConEmu**](http://conemu.github.io/) with [**PowerShell**](https://msdn.microsoft.com/en-us/powershell/mt173057.aspx) as my shell of choice. _Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows. If you are looking for customization of the Ubuntu **bash** shell, check out [this article](https://www.hanselman.com/blog/SettingUpAShinyDevelopmentEnvironmentWithinLinuxOnWindows10.aspx) by Scott Hanselman._ For source control, I use **git** for my spikes since our main source control at work is still using hosted TFS on [Visual Studio Team Services](https://www.visualstudio.com/vso/). My editor of choice nowadays is [**VS Code**](https://code.visualstudio.com/) which is lightweight, customizable and all around a good environment to do development for [Angular](https://angular.io) SPA, [NodeJS](https://nodejs.org) and spiking in. I've also done some [.NET Core](http://www.microsoft.com/net/core) developments on the editor which is supported quite well including debugging if you follow that style of development. VS Code customization is a large topic by itself, so I won't be writing about it here... Perhaps some other time... For now, we'll focus on customizing Cmder / ConEmu Powershell with git, posh-git, oh-my-posh and the Powerline fonts. Specifically on how I setup mine. A lot of people has written up about customizing PowerShell but I can only find bits and pieces. This article hopefully will combine those bits and pieces into a more coherent end-to-end story. ## Prerequisite: Install PowerShellGet If you are already on **Windows 10**, you can skip this section. If not, you will need to make sure you have **PowerShellGet** installed. We will use it to pull PS Modules from PS Gallery. Instruction on how to get **PowerShellGet** can be found [here](https://msdn.microsoft.com/powershell/gallery/readme). ## Installing Chocolatey I use **Chocolatey** as my install manager. To install **Chocolatey**, do the following from within **PowerShell**: ```PowerShell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force ``` PowerShell might complains. If so you probably need to change <code >RemoteSigned</code> to <code>ByPass</code> or <code>Unrestricted</code>. Running <code>Get-ExecutionPolicy</code> from inside PowerShell will tell you what to change it to. Afterward, run the following and wait for it to finish: ```PowerShell iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex ``` ## Installing Git using Chocolatey If you already have **git** installed, you can skip this part. Otherwise, run the following to install Git from PowerShell: ```PowerShell cinst git.install -y ``` ## Installing Cmder using Chocolatey If you already have **Cmder** installed, you can skip this part. Otherwise, run the following to install Cmder from PowerShell: ```PowerShell cinst cmder -y ``` ## Install Posh-Git and Oh-My-Posh @@ -44,7 +86,7 @@ Also make sure you set the same font for the Alternative font to use, otherwise ## How to test if Powerline is correctly installed in Cmder / ConEmu: 1. Add the following function (stole from [here](https://mnaoumov.wordpress.com/2014/06/14/unicode-literals-in-powershell/)) to your powerline $PROFILE. To edit your $PROFILE, just run <code>ise $PROFILE</code> from within PowerShell: ```PowerShell function U { @@ -66,7 +108,6 @@ function U throw "Invalid character code $Code" } ``` 2. Run the following script inside PowerShell: ```PowerShell @@ -76,6 +117,8 @@ Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26 You should see something like the second line in the figure below:  If you don't see the symbols, please make sure you did the Powerline font installation and Cmder customization as described in section 2. ## Research References [https://gist.github.com/agnoster/3712874](https://gist.github.com/agnoster/3712874) -
jchandra74 revised this gist
Apr 25, 2017 . 1 changed file with 25 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,37 +1,51 @@ # Nice Front-End / Node Development Environment on Windows 10 Setup with VS Code, Cmder, PowerShell, Posh-Git, Oh-My-Posh, and Powerline Fonts I work as a full stack developer using Windows environment. For my console need, I am using [**Cmder**](http://cmder.net/) which is based on [**ConEmu**](http://conemu.github.io/) with [**PowerShell**](https://msdn.microsoft.com/en-us/powershell/mt173057.aspx) as my shell of choice, being on Windows and all (Yes, yes, I know nowadays you can use the Linux subsystem on Windows 10 which allow you to run Ubuntu on Windows). If you are looking for customization of the Ubuntu **bash** shell, check out [this article](https://www.hanselman.com/blog/SettingUpAShinyDevelopmentEnvironmentWithinLinuxOnWindows10.aspx) by Scott Hanselman. For source control, I use **git** for my spikes since our main source control at work is still using the hosted TFS on [Visual Studio Team Services](https://www.visualstudio.com/vso/). My editor of choice nowadays is [**VS Code**](https://code.visualstudio.com/) which is lightweight, customizable and all around a good environment to do front-end development in. I've also done some [.NET Core](http://www.microsoft.com/net/core) development on the editor which is supported quite well including debugging if you follow that style of development. VS Code customization is a large topic by itself, so I won't be writing about it here. Perhaps some other time. For now, we'll focus on customizing Cmder / ConEmu Powershell with git, posh-git, oh-my-posh and the Powerline fonts. Specifically on how I setup mine. A lot of people has written up about customizing PowerShell but I can only find bits and pieces. This article hopefully will combine those bits and pieces into a more coherent end-to-end story. ## PowerShell Version Prerequitsite ## Install Posh-Git and Oh-My-Posh Installation instruction here... ```PowerShell Set-Theme agnoster ``` ## Install Powerline Fonts Clone the powerline repository from GitHub. ```PowerShell git clone https://github.com/powerline/fonts.git ``` afterward, do the following: ```PowerShell cd fonts .\install.ps1 ``` Wait for all the fonts to be installed. ## Select the Font You Want to Use from Cmder / ConEmu From inside Cmder / ConEmu settings dialog, ensure you choose the powerline font you wish to used. i.e. Menslo ... for Powerline, etc. Also make sure you set the same font for the Alternative font to use, otherwise some characters will not show. ## How to test if Powerline is correctly installed in Cmder / ConEmu: 1. Add the following function to your powerline $PROFILE. To edit your $PROFILE, just run <code>ise $PROFILE</code> from within PowerShell: ```PowerShell function U { param @@ -55,14 +69,14 @@ function U stole from [here](https://mnaoumov.wordpress.com/2014/06/14/unicode-literals-in-powershell/). 2. Run the following script inside PowerShell: ```PowerShell Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26A1) $(U 0x2699)" ``` You should see something like the second line in the figure below:  ## Research References [https://gist.github.com/agnoster/3712874](https://gist.github.com/agnoster/3712874) -
jchandra74 revised this gist
Apr 24, 2017 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,3 +61,8 @@ Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26 You should see something like the second line in the figure below:  # Research References [https://gist.github.com/agnoster/3712874] -
jchandra74 revised this gist
Apr 24, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ Also make sure you set the same font for the Alternative font to use, otherwise # How to test if Powerline is correctly installed in Cmder / ConEmu: 1. Add the following function to your powerline $PROFILE. To edit your $PROFILE, just run <code>ise $PROFILE</code> from within PowerShell: ``` function U { -
jchandra74 renamed this gist
Apr 24, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,5 +59,5 @@ stole from [here](https://mnaoumov.wordpress.com/2014/06/14/unicode-literals-in- Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26A1) $(U 0x2699)" ``` You should see something like the second line in the figure below:  -
jchandra74 renamed this gist
Apr 24, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,11 +52,12 @@ function U throw "Invalid character code $Code" } ``` stole from [here](https://mnaoumov.wordpress.com/2014/06/14/unicode-literals-in-powershell/). 2. Run the following script inside PowerShell: ``` Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26A1) $(U 0x2699)" ``` You should see something like the following:  -
jchandra74 revised this gist
Apr 24, 2017 . 1 changed file with 28 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,34 @@ # Install Posh-Git and Oh-My-Posh Installation instruction here... ``` Set-Theme agnoster ``` # Install Powerline Fonts Clone the powerline repository from GitHub. ``` git clone https://github.com/powerline/fonts.git ``` afterward, do the following: ``` cd fonts .\install.ps1 ``` Wait for all the fonts to be installed. # Select the Font You Want to Use from Cmder / ConEmu From inside Cmder / ConEmu settings dialog, ensure you choose the powerline font you wish to used. i.e. Menslo ... for Powerline, etc. Also make sure you set the same font for the Alternative font to use, otherwise some characters will not show. # How to test if Powerline is correctly installed in Cmder / ConEmu: 1. Add the following function to your powerline $PROFILE: ``` -
jchandra74 revised this gist
Apr 23, 2017 . 1 changed file with 34 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,36 @@ Installing Powerline fontts How to test if Powerline is correctly installed in Cmder / ConEmu: 1. Add the following function to your powerline $PROFILE: ``` function U { param ( [int] $Code ) if ((0 -le $Code) -and ($Code -le 0xFFFF)) { return [char] $Code } if ((0x10000 -le $Code) -and ($Code -le 0x10FFFF)) { return [char]::ConvertFromUtf32($Code) } throw "Invalid character code $Code" } ``` stole from here [https://mnaoumov.wordpress.com/2014/06/14/unicode-literals-in-powershell/]. 2. Run the following script inside PowerShell: ``` Write-Host "$(U 0xE0B0) $(U 0x00B1) $(U 0xE0A0) $(U 0x27A6) $(U 0x2718) $(U 0x26A1) $(U 0x2699)" ``` You should see something like the following:
NewerOlder