Skip to content

Seamless Sublime Text 3 Integration

Dax T Games edited this page Aug 15, 2020 · 7 revisions

For all you Windows developers using cmder, here's a method to integrate Sublime Text 3 to work seamlessly in Cmder.

This is a neat feature of ConEmu that allows you to integrate any window into Cmder.

 

Pre-requirements


Setup

Assuming that we refer to the Cmder installation folder as [cmder_root]:

  1. Download the latest portable version of Sublime Text 3 (stable) or Sublime Text 3 (dev) .zip file.

  2. Create a new folder called "Sublime Text 3" at this path:

    [cmder_root]\bin\Sublime_Text_3

  3. Extract the contents of the Sublime Text 3 .zip file into the newly created folder

  4. Add the following line to your aliases in [cmder_root]\config\user_aliases.cmd:

    subl="%CMDER_ROOT%\bin\Sublime_Text_3\sublime_text.exe" $*
    

    Refer to Split-pane integration section for splitting options.

    NOTE: Naturally you can replace subl alias with whatever alias you have in mind, as long as it doesn't conflict with an existing command.

  5. Restart cmder, and you're done.

 

How to use

Open Cmder and type 'subl' following a file name. For example:

C:\Users\Foo
λ subl bar.txt

Assuming that you are in the C:\Users\Foo directory within the cmder UI, this should open bar.txt in Sublime Text 3 and split the view.

Useful Tip!

  • If you want to edit a long-boring-file-name.txt within the current working directory, typing subl long and hitting TAB will autocomplete your partial input to subl long-boring-file-name.txt.

Demo:

Tip: If the bar.txt does not exist, sublime will create a new file with the same name in the working directory. Watch the status-bar in the bottom.

You may close sublime using File → Exit from menu (or Alt + F + X) to go back to command-line in Cmder.

 

Split-pane integration

It is also possible to merge the Sublime Text 3 UI into a Cmder tab, by splitting the view into either horizontal or vertical panes.

You can change the split behavior using the -new_console:s switch.

For example, -new_console:s75V will split the console horizontally where sublime will take up 75% of the view.

 

Edit the user-aliases.cmd file to use any of the following switches:

sublv="%CMDER_ROOT%\bin\Sublime_Text_3\sublime_text.exe" $* -new_console:s
sublv5="%CMDER_ROOT%\bin\Sublime_Text_3\sublime_text.exe" $* -new_console:s50H
subls5="%CMDER_ROOT%\bin\Sublime_Text_3\sublime_text.exe" $* -new_console:s50V
subls75="%CMDER_ROOT%\bin\Sublime_Text_3\sublime_text.exe" $* -new_console:s75V

✅ By default, -new_console:s is equivalent to -new_console:s50H.

Don't forget to reload aliases with alias /reload after each change!

 

  • Split will be created horizontally, both splits will take 50%

    -new_console:s or -new_console:s50H
    

 

  • Split will be created vertically, both splits will take 50%

    --new_console:s50V
    

 

Compact Integration

To make your sublime look better in Cmder, you can also remove further elements from Sublime Text 3.

You can remove the menu bar to make sublime look like an extension of Cmder.
To access the menu bar in sublime, you can always press Alt.

For the minimalists, you can even remove the tabs completely.
Just be sure to remember all your shortcuts!

Horizontal Split Vertical Split

 

Quick Notes

  • You can change the tab group settings of Cmder in Features → Settings and check "one tab per group".
  • To quickly exit sublime, just press Alt + F + X (File → Exit from the main menu).
  • To close the current tab in sublime, use Ctrl + W.
  • To make sublime not remember your previously opened files, change these to Preferences → Settings from the main menu.
    • "hot_exit": false
    • "remember_open_files": false

 


Guide based on ideas from @expositor.