Skip to content

This is my Windows powershell config to be used with ConEmu. It features a powerline-like prompt displaying git status and some useful aliases.

License

Notifications You must be signed in to change notification settings

Snaptags/powershell-config

Repository files navigation

powershell-config

This is my Windows powershell config to be used with ConEmu. It features a powerline-like prompt displaying git status and some useful aliases.

Alt text

Prompt only

Requirements

Setup

  • 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.: Alt text
  • you have to modify the Startup Task, too: Alt text
powershell.exe -NoExit -file "d:\prompt.ps1"

Path shortening

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: Alt text 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

Advanced features (git status, aliases, etc.)

Requirements

Install-Module PsReadline
Install-Module posh-git -Scope CurrentUser

The directory listing uses a fork of https://github.com/Davlind/PSColor/: Alt text

Colored directory listing

Install-Module PSColor

Quick Jump

Open Powershell:

Install-Module ZLocation -Scope CurrentUser

add to profile.ps1:

Import-Module ZLocation

NPM tab completion

Install-Module TabExpansionPlusPlus -AllowClobber
Install-Module NPMTabCompletion -AllowClobber

Aliases

ls -la

List all files in the current directory plus recurse all subdirectories to sum up their size. Sort the output by size: Alt text

git svn dcommit

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: Alt text

sudo

„sudo“ without any arguments opens a new powershell with admin rights. „sudo application“ starts the application with elevated rights.

es

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 Alt text

printcolors

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. Alt text

About

This is my Windows powershell config to be used with ConEmu. It features a powerline-like prompt displaying git status and some useful aliases.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published