Skip to content

Handy Tools

ConEmu

Here is the main link to Conemu website.

Show Branch Name on Command Line

Run GitShowBranch /i to install showing branch, GitShowBranch /u to uninstall.

Also, you may run your cmd as following (within Task contents or ConEmu’s Command line)

1
cmd /k ver & GitShowBranch /i

Don’t forget to recreate the console window!

If you changed the command line in the settings, you have to completely recreate the console window. Otherwise, you will not see the changes.


Add ConEmu to the Windows context menu

It is convenient to be able to open the ConEmu console at the current location. You would then want to be able to either

  1. right click either on the folder itself, or
  2. right click inside the white area within the folder open in the Windows Explorer.

Create (if not already created by the ConEmu installation itself) the same group of keys and string values in the Windows Registry in the following two locations respectively:

  1. HCR/Directory/shell
  2. HCR/Directory/Background/shell

Key: ConEmu Here

Name Type Data
(Default) REG_SZ (value not set)
Icon REG_SZ C:\Program Files\ConEmu\ConEmu64.exe,0

Subkey: command

Name Type Data
(Default) REG_SZ "C:\Program Files\ConEmu\ConEmu64.exe" -here -run {cmd}
-cur_console:n

You can also create the Admin version of the same command with minimal changes:

  • Key: ConEmu Here (Admin)
  • replace :n with :a at the end of the command Data value: -cur_console:a

TODO

It would also be nice to be able to open the ConEmu folder from within the Far Manager window.


Cmder

This tool combines most of the features of Conemu and Clink.

Environment variables

No spaces in the path names!

Make sure there are no spaces in the path. If necessary, substitute those paths with their short versions. You can find them by running dir /X in their parent directory.

Add the following environment system variables to Windows according to your specific situation:

CMDER_ROOT = C:\PROGRA~1\Cmder

Add the path to Cmder.exe to the PATH variable:

C:\PROGRA~1\Cmder

Shortcut to open Cmder in a chosen folder

  1. Open a terminal as an Administrator
  2. Navigate to the directory in which you have placed Cmder
  3. Execute .\cmder.exe /REGISTER ALL. If you get “Access Denied” ensure you are executing the command in an Administrator prompt

In the Windows explorer window right click in or on a directory to see Cmder Here in the context menu.

Configuring Tasks

Here is a good example of how to configure the environment for editing files not related to Visual Studio and .NET. Another neat functionality are customized Tasks. Use those to store different project workspaces. One task equals one workspace. Thanks to that it is possible to easily start another ‘project’ and initialize it by opening specific folders and specific files in Vim. It is a lot faster than doing everything manually.

In the Settings navigate to Startup -> Tasks and create a new predefined task with a “+” sign. Then add this code:

1
2
3
4
-new_console:d:C:\Users\mfranc\Dropbox "%ProgramFiles(x86)%\Vim\vim80\vim.exe" /k
-new_console:d:D:\ "%ProgramFiles%\Vim\vim74\vim.exe" /k -cur_console:n
-cur_console:d:D:\ "%ProgramFiles%\Git\bin\sh.exe" --login -i -cur_console:n:sT25V
-cur_console:d:D:\ "%ProgramFiles%\Git\bin\sh.exe" --login -i cur_console:n:sT66H cmd.exe -new_console:d:D:\ -i -cur_console:n:sT50H

What those commands do

  1. Creates new screen and opens Vim in my Dropbox folder context
  2. Creates new screen with Vim pointing to D:\
  3. Initializes shell in this new window and splits current screen into 75%/25% horizontaly
  4. Initializes shell in new (25%) window and splits it up into 33.3%/66.6% vertically. Then initializes shell in the new (66.6%) window and splits it up into 50%/50% vertically.

Aliases

You can create an alias to any command by an alias command, e.g.:

1
alias push=git push -u $*

No space in between!

Make sure there is no space between the alias and the equality sign =

Undo the alias by unalias push.

The aliases can be found in config subdirectory of the cmder install directory in the user-aliases.cmd file or by running alias command with no parameters.

Standard Aliases

  • cmderr - open cmder window in the cmder install directory, e.g. C:\Program Files\Cmder
  • history - show latest commands

How to update ConEmu within Cmder

Maximus5, the author of Cmder, explains how to update ConEmu to a new version. Current Cmder can contain an older ConEmu version. To update ConEmu, get the new package from the ConEmu website and copy its content to ‘your cmder installation’/vendor/conemu-maximus5 folder.


Far Manager

Add Far Manager to the Windows context menu

It is convenient to be able to open the Far Manager at the current location. You would then want to be able to either

  1. right click either on the folder itself, or
  2. right click inside the white area within the folder open in the Windows Explorer.

Create or rename (if already created by the Far Manager installation) the same group of keys and string values in the Windows Registry in the following two locations respectively:

  1. HCR/Directory/shell
  2. HCR/Directory/Background/shell

Key: Far Here

Name Type Data
(Default) REG_SZ (value not set)
Icon REG_SZ C:\Program Files\Far Manager\Far.exe,0

Subkey: command

Name Type Data
(Default) REG_SZ "C:\Program Files\Far Manager\Far.exe" "%X" "%X"

Replace X with a number!

In the shell, replace X with 1 and in the Background/shell with 2.


POSH-GIT for PowerShell

POSH-GIT is a PowerShell module that shows the current branch of the git repository and understands git commands.

Installation

The easiest way is to use PowerShell of Chocolatey.

PowerShell

1
PowerShellGet\Install-Module posh-git -Scope CurrentUser

Note: If you get an error message from Install-Module about NuGet being required to interact with NuGet-based repositories, execute the following commands to bootstrap the NuGet provider:

1
2
Install-PackageProvider NuGet -Force
Import-PackageProvider NuGet -Force

Then retry the Install-Module command above.

Chocolatey

1
choco install poshgit

Updates

Update to a newer version by executing the command:

1
Update-Module posh-git

How to use

Open the PowerShell command prompt and run:

1
Import-Module posh-git

If you are lazy to do it every time, add the command to your profile. Here is how.

  • start PowerShell command prompt and run $profile
  • you will see the path and name of your profile file, e.g. C:\Users\YourUserName\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
  • if this file does not exist, create it
  • add Import-Module posh-git to that file

Use it with Integrated Terminal in VS Code

Add the following setting to the VS Code User Settings:

1
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe,

Toggle the Integrated Terminal window with Ctrl+`.