Introduction to Win Shortcuts

May 18th 16

Moving back to a Windows environment, I spent sometime recreating my setup. Here are my current favourite apps:

Launchy

Spotlight for Windows. Must have.

Launchy Windows

Windows Navigation Shortcuts

Moving apps around the screen easily using the keyboard comes with a price. Dragging the mouse near the corners will maximise the window… Good thing you don’t need to touch the mouse now.

Enable this in the control panel:

Windows Keyboard Navigation

It provides the following shortcuts:

  • win + ↑ maximise
  • win + ↓ minimise
  • win + ← left half fill
  • win + → right half fill

AutoHotKey

Automate Windows using scripts.

A shortcut for minimising and showing a specific application, courtesy of Lifehacker:

ToggleWinMinimize(WindowTitle)
    {
                    SetTitleMatchMode,2
                    DetectHiddenWindows, Off
                    IfWinActive, %WindowTitle%
                    WinMinimize, %WindowTitle%
                    Else
                    IfWinExist, %WindowTitle%
                    {
                                    WinActivate
                    }
                    Return
    }
!c::ToggleWinMinimize("Google Chrome")      # Alt+c
    !s::ToggleWinMinimize("Sublime Text")       # Alt+s
    !t::ToggleWinMinimize("posh~git")           # Alt+t

Make sure to reload AutoHotKey after editing your script.

Here are the remaining modifiers:

  • # Win
  • ! Alt
  • ^ Control
  • + Shift

For a complete list check out the docs.

If you would like more details of more complicated scripts, check out the AutoHotkey Tutorials youtube channel.

ConEmu

Console emulator with tabs and GUI niceties such as resizing, colours and transparency.

To use PowerShell you need to specify it in Startup Tasks:

ConEmu Startup Tasks for PowerShell

Then reference the task in startup:

ConEmu Startup

PoshGit

Git environment for PowerShell including tab completion and colours.

PoshGit in ConEmu using PowerShell

Instructions from the repo:

  1. Check you are running PowerShell 2.0+ using $PSVersionTable.PSVersion
  2. Enable execution of scripts, running PowerShell as Administrator with callSet-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm.
  3. Verify that git can be run from PowerShell. If the command is not found, you will need to add a git alias or add %ProgramFiles%\Git\cmd to your PATH environment variable.
  4. Clone the posh-git repository.
  5. Run .\install.ps1 from posh-git.

Prompt

I prefer a more minimalist prompt that displays only the current directory folder rather than the full path.

  • Powershell
notepad $profile
function profile {
    (get-item $pwd).Name
}
  • Posh-Git

Update the profile.example.ps1 to use:

Write-Host((get-item $pwd).Name) -nonewline
  • PowerShell Aliases

Unfortunately creating aliases in PowerShell is not that straight forward. You have to define a function and also unbind the command if it is already being used.

For example if you wanted a shorthand for adding commits you would do the following:

# Remove Defaults
rename-item alias:\gcm gkm -force

# Define Function
function git-commit-m { git commit -m $args }

# Set Alias
Set-Alias -Name gcm -Value git-commit-m

The complete list of my aliases on Windows are here

Share Mouse

If you are using multiple computers simultaneously it is really useful to be able to share one keyboard and mouse. This is great when you are using different operating systems.

I had been using Synergy previously but found that it was becoming temperamental. Share Mouse is great and it just works out of the box.

Make what you need; Shuffi

Next