ConEmu: The Dos Command but better

If you are a Front-end developer you may have worked with several command windows open. I always have a minimal of 3 or 4 command windows open. One for Git, one for npm start (building projects), one for npm test (testing projects) and most of the time also one for some other stuff I am doing. So, most of the time one of my desktops look something like this.

I like to have all the console windows visible to be able to see live updates when watching files. That why I like to use the Windows feature for stacking windows with WIN + Arrow Key.

On very annoying thing about several windows is that when you have some other windows (like a browser) temporarily on the desktop with the consoles is that when using Alt + Tab only focus one of the command windows. The other thing I don't like is the face of having multiple console windows in the taskbar.

Fortunately, there is a solution for that. It's called 'ConEmu' (https://conemu.github.io/). It's a windows console emulator which contains Tabs and Splitpanes! Yes... That what I need. Default it looks like below. 

With Ctrl+Shift+E or Ctrl+Shift+O you can split the command window in vertical or horizonal tabs. It is also possible to have tabs stacked with Windows+W.

The console will then look something like this:

Great!! So, know I can use Alt+Tab to switch to all consoles at once. If you also want one item in the taskbar (like I do) you can this in the settings window:

So Yes!! I finally have one window that contains all the consoles I need in my project.

But things get better and better!!!....

It is possible to start ConEmu with command parameters. So, it is possible to start the windows with all your windows in place and in the directory you want. To start with multiple windows, you can do the following:

start conemu64.exe 
        -title "GIT-SRC-TESTS" 
        -runlist -new_console:d:"C:\YourGitRepo\":t:GIT 
        ^|^|^| -cur_console:s1T70V:d:"C:\YourGitRepo\src\":t:SRC 
        ^|^|^| -cur_console:s2T50H:d:"C:\YourGitRepo\tests\":t:TESTS

The line break in the sample above should be removed. All should be on one line.

The command above sets the title for the ConEmu window. Then it uses the -runlist parameter to be able to run multiple commands. The first command is opening a new console (-new_console) in the directory C:\YourGitRepo and gives the tab the name 'GIT'. Then there are the ^|^|^| to split the commands and a second console is added with -cur_console, it is added to the first console s1T and made 70 percent of the height vertically (70V).

The output of the above command will result in a window like below:

More about the several command line arguments can be found on the ConEmu website.

But.... Again!! I can even be better...

ConEmu contains 'Tasks' which are predefined command groups:

These tasks can be requested from the command line (or batch file) by using the following command:

ConEmu64.exe -run {Bash::Git bash}

In the sample above the task '{Bash::Git bash}' is triggered, which opens a new command window started with bash on the current directory.
Best part of this is that you can also create your own tasks. Let's take the example from earlier to create a task that creates one ConEmu window with 3 splitted tabs on the correct directories. I created a new task called '{cmd::MyProject}' and in the command window I added the following code (beware, line-breaks are important here).

-cur_console:d:"C:\YourGitRepo" -cur_console:t:GIT2 cmd

-cur_console:s1T70V -cur_console:d:"C:\YourGitRepo\src" -cur_console:t:SRC cmd

> -cur_console:s2T50H -cur_console:d:"C:\YourGitRepo\tests" -cur_console:t:TEST cmd

You may wondering what the '>' sign means, but this will be the active tab. In the settings window it looks like this:

Tip: If you have set up the tabs by hand you can press the 'Active tabs' button in the right bottom corner. This will create the correct text for you.

So now it is possible to start the same tabs with just:

ConEmu64.exe -run {cmd::MyProject}

I really like this ConEmu and there are a lot of configurations you can change to customize it to your wishes. Personally I like my tabs below and some other colors. There is also another command emulator Cmder (http://cmder.net/) which is based on ConEmu. I like the colors used with Cmder, but I could not clearly find how to start cmder with tasks. In the directory of Cmder you can find the folder that contains ConEmu. I use that ConEmu64.exe to have the default colors of Cmder. But of course It's totally up to you to decide what you like!

Happy Coding!