TL;DR Use Bash on Windows like me and you’ll be in heaven too, with penguins and ice creams :)
Update 2015-08-07: I now use ConEmu rather than Console2; apart from this, my configuration is still as described below
In this post I’ll describe my current Windows configuration and development environment. I’ve already covered how I’ve customized my Windows 10 install, but here I’m going to explain what I do to have an efficient workflow and a ‘portable’ configuration.
For those wondering, yes I use Windows as my main operating system (don’t throw the tomatoes just yet). As I’ve said in the past, I do prefer Linux, but I also enjoy gaming and dual boot is just not for me anymore. Moreover having one OS across all the machines I use at home and at work (apart from tablets) is useful.
Before going in the nitty gritty details, here’s a brief overview of my setup:
- CloudStation (Synology NAS application): synchronizes files between my desktop, NAS, laptop & tablets; you can substitute this with Dropbox or whatever else you like
- Git (i.e., msysGit) & git bash: because I love git and MSYS
- Console: a great Windows console enhancement (supports multiple tabs, different shells, different fonts, easy text selection, shortcuts, …
- AutoHotkey: create macros & scripts. I use it to show/hide my bash console with the ‘²’ key
- bash profile: if you know *nix, you know this but I’ll cover the basics below
- a ton of portable apps (or non-portable ones adapted)
- GitHub: great Git client for Windows
Here are a few examples of things I can do with my setup (on all my Windows machines):
- hit ‘²’ and start typings commands
- use common *nix commands such as ls, cat, less, sed, …
- type ‘e’ and have the File Explorer opened in the current folder
- type ‘s’ and have Sublime Text opened
- type ‘s cool’ and have Sublime Text opened with the file ‘cool’ opened it in
- type ‘npp’ and have Notepad++ opened
- type ‘n’ and have my notes opened
- type ‘m’ and have my GMail mailbox opened
- type ‘g cool’ and have a new browser tab open with the Google search results for ‘cool’
- type ‘imdb shawshank redemption’ and see the IMDb info about the best movie of all times
- type ‘wiki’ and have my wiki opened
- type ‘f’ and get facebook opened
- type ‘nlfr echt waar’ and have google translate opened with the translation of ‘echt waar’ from dutch to french
- same with frnl fren …
- type ‘img mario’ and see pictures of Mario all over
- type ‘mkcd test’ and have the test folder created and cd into it
- type ‘ws’ and have WebStorm started
- type ‘idea’ and have IntelliJ started
- type ‘write 001′ and have my 001 project opened in Scrivener
- type ..3 and be 3 levels higher in the file system tree
- type ‘p’ and have my bash profile opened for edition in Sublime Text
- type ‘mindmap’ and have my Mindmap opened in FreeMind
- well you get the idea … :)
The goal of my setup is to strictly limit the number of steps to get my development environment up and running (e.g., after I get a new device or need to reinstall one) and to synchronize my configuration(s) between all devices I work on.
At the heart of my configuration, there is CloudStation, the synchronization app provided by Synology NASes (best NAS devices you can find on the market). I use CloudStation to synchronize the following between my devices:
- Configuration files (I’ll cover these later)
- Books I’m currently reading (or plan to read soon)
- Comic books (only thing that I synchronize w/ my tablet)
- Pictures (e.g., wallpapers & pictures of my face — if I need to upload one somewhere)
- Book drafts (stuff I’m writing from time to time)
- My notes.txt file
The most important parts are the config files and programs because that’s the core of my setup.
My CloudStation folder is organized as follows:
- _FOR_HOME: stuff to bring back home
- _FOR_WORK: stuff to bring to work
- _NOW: stuff I’m currently busy with
- Bash: contains my bash profile
- Dev: contains the configuration for all my dev tools
- Eclipse: my Eclipse preference files (.epf), code style rules, etc
- IntelliJ: my portable IntelliJ config (config & plugins)
- WebStorm: my portable WebStorm config (config & plugins)
- Templates: project templates
- Home: my *NIX home folder (.gitconfig, .npmrc, .ssh folder, etc are in there)
- XBMC: my portable XBMC config (worth another post in itself)
- Electronics: my current electronics projects
- Guitar: that thing with strings that I learn when I find free time (i.e., not often enough)
- Lightroom: my LR catalog (worth another post in itself)
- Music: things that I listen again and again
- dev: JDK, maven, docker-machine, groovy, intellij, mongodb, nodejs, npm, python, eclipse, svn, webstorm, …
- electronics: arduino IDE, atanua, circuit, fritzing, …
- emulation: zsnes, project64, …
- games: minecraft and other small games ;-)
- readers: e-book readers & comic book readers (e.g., ComicRack)
- seb: my own tools
- tools: a huge ton of (portable) apps
- writing: apps like Scrivener, WriteMonkey, …
To give you an idea of the tools I have in CloudStation, here’s a part of what I use:
- SublimeText: my current preferred text editor (no it’s not VI, I’m more of a nano guy)
- Notepad++: my previous preferred text editor
- SysInternals suite: greatest Windows toolkit ever
- 7-zip: it does it all
- KeePass: one passphrase to rule them all
- kitty: putty portable replacement
- AntMovieCatalog (again worth another post)
- AutoHotKey (more on it below)
- borderless window tool: useful for games that don’t have a fullscreen windowed mode
- calibre: manage my e-books
- Console2: awesome Windows console replacement (more on it below)
- desktops: obsolete with Windows 10 :)
- ffmpeg: holy grail (or so I thought)
- exiftool: dump exif
- ext2explore: let me see EXT partitions
- fat32format: format stuff
- folder2iso: sudo make me an iso
- freemind: can’t live without mindmaps
- HexChat: coz IRC is still there in 2015 (yeah I’m tired looking for the links ^^)
- ImageMagick: do me some magic with images
- JDownloader: download all the things
- jude: sometimes helpful for quick UML drawings
- libmp3lame: encoding stuffz
- mplayer: who can live decently without mplayer around?
- MySQL Workbench
- netcat: netcat for Windows, weee
- PortQry: check UDP ports
- Privoxy: local proxy
- ProxyGet: dumps info about the currently configured proxy (useful in locked-down environments)
- PS3Splitter: split large files
- restoration: restore deleted files (family helper)
- SolEol: download subtitles easily
- SteamMover: move steam folders around
- SubtitleEdit: fix me thy subtitles
- twt: CLI for Twitter
- wakeMeOnLan: wake up LAN devices
- win32diskimager: create img files
- WinDirStat: where’s my free space gone??!
- WinMerge: diff me up
- WinSplitRevolution: can’t live without this to re-arrange/resize windows around
- YNAB: yes you do need a budget
Okay so all of that currently sums up to about 30GB so clearly the initial sync time is quite long because there are a huge amount of very small files to sync, but once synchronized, you get an idea of all I have available at my fingertips.
There are apps that I do actually install on my OS for two reasons: either the app is way too large to be copied around or it integrates too deeply with the operating system. Here are some applications that aren’t in my CloudStation folder:
- VLC: much easier to install & have the file type associations
- Winamp: same idea
- Google Chrome
- Daemon Tools
- CrashPlan client
- GitHub client
Okay, so far you have an idea of the stuff I carry around with my but you don’t know yet how I use it all. Let’s assume for a moment that my PC goes up in flames and that I need to setup a brand new one.
Here’s what I need to do in order to get back up and running (to the point of being able to work):
- install the OS (haha)
- install drivers (hoho)
- install CloudStation and let it sync all my files
- install msysGit
- create a .profile (bash profile) file in my home folder with the following contents
- source /c/CloudStation/Configuration/Bash/bashProfile.txt
- this loads my actual bash profile which is part of my CloudStation synchronized files
- add AutoHotkey to the startup list (i.e., put a shortcut under ‘shell:Startup’)
- copy my AutoHotkey script to the Documents folder
- at this point I can already hit ‘²’ and my console opens up, with all my tools available
- install the few other apps I like to have
Okay so let’s see how my console is set up.
So when the OS boots, it now starts AutoHotkey. I’ve written a small script that opens up Console2 when I hit ‘²’ and hides it when I hit ‘²’ again, a bit like Quake’s console or Yakuake under Linux (although I don’t have the nice animation ;-)).
Here’s the script
; QuakeConsole, used in combination with Console2
; Change your hotkey here
;SC029 == ²
IfWinExist ahk_class Console_2_Main
IfWinActive ahk_class Console_2_Main
WinHide ahk_class Console_2_Main
WinActivate ahk_class Shell_TrayWnd
; put the console at top left
WinMove, 0, 0
; show the console
WinShow ahk_class Console_2_Main
WinActivate ahk_class Console_2_Main
The script is quite simple: if Console2 is running, pressing the configured key will either show/hide the window (and put it on the top left of the screen on show); if not, it starts the program.
As you can see Console2 is also in my CloudStation folder, just like AutoHotkey is.
So now, here are the relevant parts of my Console2 configuration (console.xml file placed in the Console2 program folder in my CloudStation tools)
With this Console2 configuration:
- I automatically get in a Git Bash shell in my workspace (i.e., where I have my project folders)
- I can hit ctrl+ F1 to open a new tab, also with the same Git Bash shell
- I can use ctrl + c / ctrl + v to copy/paste
- I can use the middle mouse click to paste
- I can use shift + click to select & copy text
Okay thus so far you can see how I can use my bash shell on Windows, I just hit ‘²’ and I can enter commands, not much harder than hidding the Windows key to open up the start menu & searching for stuff, except that in my shell I’ve got all my commands & aliases available.
The final (and most important) part of my configuration is my bash profile. It’s where I configure my environment, define functions and aliases, configure programs in my path, etc.
Given how long it is I’ve create a Gist of it here (note that it’s just a subset of my whole config): https://gist.github.com/dsebastien/47d24a5d6c1b8005f434
I don’t claim any rights on the functions I use in my bash profile as it is mostly based on stuff I gathered over time from various sources. Though there mustn’t be many crazies like me to do this kind of things on Windows ;-)
In the file, you’ll see that the basic principles are quite simple & straightforward, folders added to the path, functions and aliases with shorter names, etc.
I have tons of ideas to improve my bash profile but I just don’t have time now. There are just tons of worth-looking examples all over the place if you’re interested. And if you have ideas/links, just post them in the comments!
What I like with my current configuration is that it is portable in the sense that if I add a new tool or change the configuration of an existing one, all my machines are directly updated.
Of course it is far from perfect, most apps aren’t up to date and the more I add into my system, the harder it gets to update stuff. Package managers are indeed the solution and *NIX has had them since the dawn of ages, but there’s hope on Windows too.
In the future, Windows package managers like OneGet (now part of W10) and Chocolatey should simplify things, but I don’t feel like it’s usable for my goals right now (correct me if I’m wrong).
The most evident and easiest solution would simply be to use Linux, but for as long as I’ll be playing games from time to time, I won’t go back.