Yes, you’ve read the title right! It’s possible to some extent.
Working on some projects on windows, I still needed to use at least git. As the preferred way of interacting with it is via the command line, there was a necessity to set up a proper console there. Strange enough, there isn’t much information about configuring the stuff on the internets. The default windows’ cmd.exe shell and the terminal emulator are horrible, if you’ve ever used a linux shell (such as bash or zsh), so those are dead end. I needed something like yakuake from KDE or iTerm2 on OS X, which have the crucial feature of one-button appearance and disappearance.
As a git distro I use portablegit on windows, which comes with the bash shell.
First of all, get Console2 to, say, e:\portable\Console2\ directory. If you run it now, you’ll get the standard, very poor cmd.exe command interpreter, but in a better looking and more functional terminal emulator.
Ctrl-D, Ctrl-D,… doesn’t work here, at least exit works.
Now we’re connecting it with portablegit (download a file with name like PortableGit-1.7.11-preview20120710.7z). Unpack the archive in e:\portable\portablegit\ directory. Running git-bash.bat will give you the standard, very functionally limited terminal emulator, but with much more powerful bash command interpreter (that everybody knows in Linux and other UNIXes).
Ctrl-D. Better, but not quite what we want yet. Digging more…
An important line in the git-bash.bat file is marked with the :startbash label:
1
call%COMSPEC% /c %BIN%bash --login -i
which runs the shell. Now, run Console2 again, go to Settings (Ctrl-S), the Console category on the left has Shell: field to the right. Put the path to bash.exe file there, \portable\portablegit\bin\bash --login -i in our case. Restart the program, and bash will be loaded inside. Much better!
A few more tweaks are required to make it look more like a real drop-down terminal, without those fancy toolbars, menus, and window decorations. In Appearance / More, deselect Show menu, Show toolbar, Show status bar, and Show scrollbars. In Styles section, turn off Caption, Border, and Taskbar button as well. Unfortunately, Resizable option leaves an ugly border around the window, so I had to deactivate it too. Here’s what I got:
Another addition, you can expand the area for the terminal by setting bigger Window size, to something like 138x38. Fine, we’ve configured the terminal emulator, and one thing left, namely setting a hotkey for instant access to it.
That’s where AutoHotkey_L comes into play. Unpack the executable file to e:\portable\ directory. Drop the QuakeTerminal.ahk file into the same dir:
AutoHotkey script for fast access to console (QuakeTerminal.ahk)download
1234567891011121314151617181920212223242526272829
last_active_window:=0#WinActivateForce; Change your hotkey hereF12::DetectHiddenWindows,onIfWinExistahk_classConsole_2_Main{IfWinActiveahk_classConsole_2_Main{WinHideahk_classConsole_2_MainWinActivateahk_id%last_active_window%}else{WinGet,last_active_window,ID,AWinShowahk_classConsole_2_MainWinActivateahk_classConsole_2_Main}}else{WinGet,last_active_window,ID,ARunConsole2\Console.exe}DetectHiddenWindows,offreturn
To run the script, you need to pass its filename to the interpreter. To simplify the matters, here’s a quick and dirty startup batch file:
The hotkey is specified in the .ahk file, F12 by default. So, you start the .bat file, press the hotkey, and after a while the Console with bash inside appears. Another hotkey press, and it’s gone…
That’s all for today, folks! This lifehack allowed to me survive in the not very friendly windows environment for some time. git works there, and so does vim. If you have any comments, share them!