This is my Windows powershell config to be used with ConEmu. It features a powerline-like prompt displaying git status and some useful aliases.
- https://github.com/Snaptags/powershell-config/blob/master/prompt.ps1
- https://github.com/gabrielelana/awesome-terminal-fonts
- Copy the prompt.ps1 file to a location of your choice. Make sure it is UTF-8 format.
- allow powershell to execute scripts:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
- Install a powerline enabled font from the second of the links provided above.
- open the ConEmu settings and apply the new font, e.g.:
- you have to modify the Startup Task, too:
powershell.exe -NoExit -file "d:\prompt.ps1"
I don't like it when the paths are getting too long, especially when working in git folders. So I added a path shortener to prompt.ps1: You can change the behaviour by editing prompt.ps1:
$script:max_path_length = 40;
Set this to 0 to turn path shortening OFF. Note beyond: you can always get the full path by entering 'pwd' in the shell prompt:
PS > pwd
Install-Module PsReadline
Install-Module posh-git -Scope CurrentUser
The directory listing uses a fork of https://github.com/Davlind/PSColor/:
Install-Module PSColor
- use ZLocation instead of Jump-Location
- https://github.com/vors/ZLocation
Open Powershell:
Install-Module ZLocation -Scope CurrentUser
add to profile.ps1:
Import-Module ZLocation
Install-Module TabExpansionPlusPlus -AllowClobber
Install-Module NPMTabCompletion -AllowClobber
List all files in the current directory plus recurse all subdirectories to sum up their size. Sort the output by size:
I have to commit to a subversion repository. After my first accidental dcommit from a broken local branch I added this alias, inspired by http://stackoverflow.com/questions/9226528/how-can-i-avoid-an-accidental-dcommit-from-a-local-branch:
„sudo“ without any arguments opens a new powershell with admin rights. „sudo application“ starts the application with elevated rights.
Finds files using Voidtools' Everything. Based on https://github.com/DBremen/PowerShellScripts You need do download and install the commandline tool via http://www.voidtools.com/es.zip
I use a very strange color scheme in ComEmu, optimized to look good when opening vim. To get a matching powerline prompt for the shell I used this alias.