For all you Windows developer using cmder, here is a neat way to integrate cmder and sublime text to work seamlessly.
Step 1: Create a new folder called 'Sublime Text 3' in the '/cmder/vendor/' location. You should also see the folders /clink, /conemu-maximus5, and /mysgit.
Step 2: Download a portable version of Sublime Text 3 from their website and unzip the content into the newly created Sublime Text 3 folder.
Step 3: Then, in the aliases file under /cmder/config/aliases, add:
subl="%CMDER_ROOT%\vendor\Sublime Text 3\sublime_text.exe" $1 -new_console:s75V
You can change 'subl' with any alias you want, hopefully one that doesn't conflict with an existing command.
Like the view above, the -new_console:s75V will split the console horizontally where sublime will take up 75% of the view. You can also change the split behavior. Here are some other examples:
-new_console:s or -new_console:s50H
Split will be created to the right, both splits becomes 50%.
-new_console:s50V
Split will be created horizontally, both splits becomes 50%.
-new_console
Just simply putting new_console with no value afterward will replace the entire screen with sublime, another preffered method of mine.
Of course, you can make several aliases, like sublf for full screen, sublr for right split, etc.
**Step 4:** Start or restart cmder and type 'subl' and a file name. For example:
C:\Users\Foo λ subl foo.txt
Foo.txt should open in sublime text 3 and split your screen. If 'foo.txt' exists, it should open that file, otherwise, it will create a new 'foo.txt' file in your directory. Here, I didn't have a foo.txt file in my directory when I typed that command. After pressing Ctrl S, it created a new foo.txt and saved it in the current working directory. Check out the status on the bottom.

Of course, to make it look extra integrated, I removed the tabs in sublime. For the minimalists, you can even remove the menu bar and the status bar, so it looks like a complete extension of the cmder. Honestly, I prefer the menu bar.

Remember, you can you can always open the menu again by pressing 'Alt'. Also, in the conemu setting, I changed the tab group in the Features-->settings and checked 'one tab per group'. Again, for the minimalists, you can even remove the tabs completely. Just be sure to remember all your shortcuts!
Minimalist setup right here:
Horizontal Split.

Vertical Split

Another neat timesaving tip is that you can autocomplete queries by pressing TAB. So if the filename is called Vagrantfile, then all you have to do is type subl vag and press TAB, and it should auto-complete.
**Step 5:** To quickly exit sublime, you just press Alt F X. And you're back to your cmd. Pretty sweet!
**Bonus Step 6:**To make sublime text not remember your previously opened files, in Sublime, under Preferences-->Settings - User, put:
// Settings in here override those in "Default/Preferences.sublime-settings", // and are overridden in turn by file type specific settings. { "hot_exit": false, "remember_open_files": false }
So now, when you just type 'subl', see that it creates a blank document.
C:\Users\Foo λ subl

Neat! just doesn't user the user profile settings/packages.
I was using console2, but like this a lot better!
I set Cmder up to open bash by default, is there a way to open sublime in bash the same way you showed above? I tried adding an alias to my .bashrc file, but that didnt work...
alias subl='"%CMDER_ROOT%\vendor\sublime3\sublime_text.exe" $1 -new_console:s75V'
Edit this is the bash I'm referring to http://msysgit.github.io , i created a new task in Cmder and am pointing it to "C:\Program Files (x86)\Git\bin\sh.exe", i tried the alias below and it didnt work either...
alias subl='/c/Users/Daniel/Desktop/cmder/vendor/sublime3/sublime_text.exe" $1 -new_console:s75V'
Is there a way to put sublime at the top when doing v split?
WOW! This is super sexy <3 really love this. Thanks!
isimmons said:
Is there a way to put sublime at the top when doing v split?
After a while of searching, I finally found a way that ended up being not that difficult.
In the main directory of Cmder, create a new bat file called sublimeConsoleAdd.bat that contains the following :
"%CMDER_ROOT%\vendor\Sublime Text 3\sublime_text.exe" $1 -new_console:s50V cmd /k "%ConEmuDir%..\init.bat" -new_console:s25V exit
Then when you would have subl="%CMDER_ROOT%\vendor\Sublime Text 3\sublime_text.exe" $1 -new_console:s75V in aliases, put subl=sublimeConsoleAdd.bat and that will do the trick.
Since it appears that Cmder only will split to the right or below, you have to create the separate windows in order, then remove the original one that would be above Sublime Text.
Also thanks a ton for this awesome tutorial expositor!
How to do all of this in powershell task of cmder ?
Hello people. I already have sublime installed on my machine under "C:\Program Files\Sublime Text 3\sublime_text.exe"
and I created an alias as this
subl="C:\Program Files\Sublime Text 3\sublime_text.exe" $1 -new_console:s75V
But doesn't seem to work. Do I need to have it in the vendor folder of cmder ?
Hello! I've been unable to achieve the Sublime/Cmder integration result. Tried setting a CMDER_ROOT environment variable, tried using Cmder as an administrator, tried restarting the machine, etc...and I still get the message "The system cannot find the path specified" whenever I try to run: subl . or subl <filename>
Anyone here have any alternative suggestions?
jeffreysbrother said:
Hello! I've been unable to achieve the Sublime/Cmder integration result. Tried setting a CMDER_ROOT environment variable, tried using Cmder as an administrator, tried restarting the machine, etc...and I still get the message "The system cannot find the path specified" whenever I try to run: subl . or subl <filename>
Anyone here have any alternative suggestions?
Hi, not sure if you've already solved your problem. The reason Windows is throwing you the error message "The system cannot find the path specified" in this case is because there is are spaces in the file path you're trying to alias.
I encountered the same issue and fixed it by using a shortname in place of "Sublime Text X". You could try the following: subl="C:\tools\cmder\vendor\SUBLIM~1\sublime_text.exe" $1 -new_console:s75V
I got the shortname SUBLIM~1 by following the steps illustrated here Happy dev'ing!
henray said:
jeffreysbrother said:
Hello! I've been unable to achieve the Sublime/Cmder integration result. Tried setting a CMDER_ROOT environment variable, tried using Cmder as an administrator, tried restarting the machine, etc...and I still get the message "The system cannot find the path specified" whenever I try to run: subl . or subl <filename>
Anyone here have any alternative suggestions?
Hi, not sure if you've already solved your problem. The reason Windows is throwing you the error message "The system cannot find the path specified" in this case is because there is are spaces in the file path you're trying to alias.
I encountered the same issue and fixed it by using a shortname in place of "Sublime Text X". You could try the following: subl="C:\tools\cmder\vendor\SUBLIM~1\sublime_text.exe" $1 -new_console:s75V
I got the shortname SUBLIM~1 by following the steps illustrated here Happy dev'ing!
Hello
I've just made it work using this line in the alias file: (In Windows 7)
subl="D:\Tools\cmder\vendor\sublime-text-3\sublime_text.exe" $1 -new_console:s75V
the folder for sublime can't have spaces or it won't work. On the other hand, the %CMDER_ROOT% as a enviromen variable didn't work so I had to use the exact path to it.
Hope it helps :)
Because cmder is a fork of conemu, will this work with conEmu as well ??
EDIT:
it turns out its possible with conemu as well.
What $1 parameter does? How can I get sublime to open the current folder I am in, like subl . in mac?
[EDIT] Sublime settings: "hot_exit": false, "remember_open_files": false
and Cmder alias: subl="C:\Program Files\Sublime Text 3\sublime_text.exe" . -new_console:s75V
did the trick!
This is working for me, but if I open a new tab in cmder and try opening another file, it'll open that file in the original instance of sublime rather that the current tab. Is it possible to have two separate sublime projects open simultaneously (each in their own cmder tab)?
You may be able to just extract a second portable ST3 in the vendor folder and have a different alias. Could symlink the preferences possibly.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community