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.
I’ve come up with a setup based on the solution here: http://blog.errorok.com/2009/05/26/168/. You’ll need AutoHotkey_L (regular, old AutoHotkey should work as well), Console2, and QuakeTerminal.ahk script.
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
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
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
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!