Console2 and Sublime Text 2

Had read about Console2 (a command prompt application) and Sublime Text 2 (a code editor) on many blogs and decided to give them a try today.

Sublime Text 2 is straight-forward. (1) Download from here and install, (2) navigate to the folder where you installed it and then the Data\Packages folder within that, (3) create a folder called PowerShell there, (4) download this GitHub repostiry as a zip file, and (5) unzip it into the PowerShell folder previously created. Steps 2-5 are for adding PowerShell syntax highlighting to Sublime Text.

That’s just scratching the surface though. I’ve still got to explore why Sublime Text is so cool. It looks great if nothing else; I like the colors and fonts and just how it looks over all.

Console2 is also straight-forward. Download, install, and launch. Then go to Edit > Settings to tweak things. Here’s what I changed:

  • Under the Console section I set the Shell to PowerShell (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe) and the Startup directory to my folder containing code.
  • Under the same section I set the Window size to be 38×163. Arrived at this number by resizing the window with my mouse (the size appears in the bottom right corner of the status bar). That’s a cool thing about Console2 – you can resize it with the mouse!
  • Under the Appearance section I unticked Show command, Show command in tabs, and Tab titles. Ticked Use console window title. Set the font to Consolas size 12, with ClearType smoothing. Also I set the initial position to 45×58. Arrived at this number through trial and error for my screen.
  • Under the Appearance | More ... section I un-ticked Show menu/ toolbar/ status bar and also Tray icon. Set the Window transparency Alpha for both windows to 10. Number arrived at through trial and error.
  • Under the Behavior section I ticked Copy on select. This will give me the default PowerShell behavior which is to copy text to the clipboard when I select it. The cool thing is now it will work for the regular Command Prompt too!
  • Under the Hotkeys section I changed Copy selection to be Ctrl+X and Paste selection to be Ctrl+V. I really didn’t need to change the hotkey for Copy as just selecting text will copy it now thanks to the setting in the Behavior section. But it’s convenient to be able to Ctrl+V for paste. I didn’t set Ctrl+C as the hotkey for Copy as that would stop me from being able to interrupt commands via Ctrl+C.
  • Under the HotKeys | Mouse section I cleared the entry for Copy/ clear selection and assigned Left (without any modifiers) to Select text. This way I can just left click and select text with the mouse (and it will be automatically copied to the clipboard anyways thanks to the setting in the Behavior section). I assigned Right (without any modifiers) to Paste text, and Right with the Ctrl modifier to the Context menu. (Update: I have since changed my mind and assigned Paste as Right with Ctrl modifier (the default) and Context menu as Right (without any modifier) (the default). That way I don’t accidentally paste text by right clicking anywhere in the window).
  • Lastly, under the Tabs section I made removed the existing entry and made two. One called POSH, with C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe as the Shell and my code folder as the Startup dir (could skip the latter I guess as it’s set as the default earlier). And another called CMD, with C:\Windows\System32\cmd.exe as the Shell and my code folder as the Startup dir. For both these entries I set the Icon field too. You can only supply ICO files as icons, so I used IconsExtract to extract the icons from the PowerShell and command prompt executables and saved them as ICO files.

And that’s it.

A cool thing about Console2 is that the two tabs I defined above are just “types” of tabs.

Here I defined one tab of type PowerShell, another of type Command Prompt. I could create other types too – for say, the BASH shell, a script based menu, an SSH session (not PuTTY though, that opens a new window and crashes Console2) and so on. I can make up to 10 such tabs – or at least I can assign shortcuts for up to 10 such tabs – so using the default shortcuts I can press Ctrl+F1 and in my case that will create a new tab with PowerShell loaded. I can cycle through these tabs with Ctrl+Tab and Ctrl+Shift+Tab as usual and close these with Ctrl+W too. All hotkeys can be changed too. Neat!

Update: Console2 stores its configuration in a file called console.xml in the same folder as the program. I have uploaded my copy of this file, along with the two icons, here.