ConEmu conemu, bash

Console2 reboot

I’ve used for long time the very good Console2. But I’ve discovered last month a Russian programmer who has build some really good stuff !

So first, go to ConEmu and install it (pick the dev build, it has some good new features and work well !)

ConEmu basic configuration

ConEmu can be fine tuned with a lot of configuration possibility. In the setting :

Move around and test !

ConEmu Task

You can define multiple standard task in startup/tasks.

I’ve created a first simple :

It’s the most important part. The format of the macro command is :

program-name -new_console:options-console parameter-for-the-program

Take a look at the about box for remember the options :

-new_console[:switches]
  or
-cur_console[:switches]
   a - RunAs shell verb (as Admin on Vista+, login/passw in Win2k and WinXP)
   b - Create background tab
   c - force enable 'Press Enter or Esc to close console' (default)
   d:<dir> - specify working directory, MUST BE LAST or single OPTION
   h<height> - i.e., h0 - turn buffer off, h9999 - switch to 9999 lines
   i - don't inject ConEmuHk into starting process
   n - disable 'Press Enter or Esc to close console'
   o - don't enable 'Long console output' when starting command from Far Manager
   r - run as restricted user
   s[<SplitTab>T][<Percents>](H|V) - run new console in a split
   t:tabname - rename new created tab, MUST BE LAST or signle OPTION
   u - ConEmu choose user dialog
   u:<user>:<pwd> - specify user/pwd in args, MUST BE LAST or signle OPTION

Simples examples

Just add a task with : cmd in the third input (‘commands …’) with a title (first input). You can now launch a DOS shell simply.

Next step : launch the bash shell (sh.exe is en the PATH) : sh -login -i.

And for a Git shell (not in my path) : c:\dev\git\bin\sh.exe -login -i

If you want to specify the starting directory, you have to use the -new_console switch : c:\dev\git\bin\sh.exe -cur_console:d:C:\www\github\ -login -i for example.

Starting a batch file in a new console

Depending on each program, for bash it’s the switch -c. So, assume i want to launch a Ruby pry console from the bash shell : sh -new_console:d:C:\www -l -i -c "pry". You can do the same for a rails console, a rails server, a jekyll server …

Launch several windowed consoles

>c:\dev\git\bin\sh.exe -cur_console:d:C:\www\github\traz.github.com -login -i
sh.exe -cur_console:s1TH:d:C:\www\github\traz.github.com -login -i -c "jekyll serve"

On the first line, I launch a git bash shell (with full route because it’s not in my PATH) with option -login -i, with a starting directory specified (:d switch)

On the second line, I launch the Jekyll local server and with the switch s1TH for (s)eparing the current (1)st one console in 2 (H)orizontal windows.

The > character select which console is active.

So when the task is launch, I’ve got my Git shell and my local server up.

Another example with Rails :

>sh -cur_console:d:C:\www\red -l -i -c "rails console"
c:\dev\git\bin\sh.exe -cur_console:s1TH:d:C:\www\red -login -i
sh -cur_console:s2TV:d:C:\www\red -login -i -c "rails server"

In this one, I’ve a got a PRY rails console (check the ‘pry-rails’ gem in gemfile), a Git shell, and the rails server up.

Attach & Inside …

Lasts words : You can attach a program in ConEmu … try it, it’s surprising on the first time :) But it extend the tasks possibilities :

Now in a new task, just put "C:\Program Files\Sublime Text 2\sublime_text.exe" … and Yes ! you’ve got Sublime Text IN a tab console, working perfectly :) … you can test with other programs :)

And for finish, you can do (it’s a testing feature I assume, there some nasty behaviors) the exact opposite : integrate ConEmu in a Windows Explorer ! First, register ConEmu in the Explorer context menu (it’s in tab Features / Integration in ConEmu), and second, right click in the explorer on ConMenu Inside :)

</br>
>
> > ->Update April 5 2013<- > >
</br>

How to set title tab AND starting directory

Taking a look at the documentation, cur_console (and new_console) can’t take both options : set title tab (:t:MyTitle) and set starting directory (:d:C:\www\ ie).

But you can specify some options in ‘task parameter’ : ie /dir "C:\www\" . So you set your directory in the task parameters, and you can set your tab title in the commands panel.

A big thanks again to the programmer of ConEmu !!!

Additional information : check :


comments powered by Disqus