Home Download Buy Blog Forum Support

Sublemacs Pro - Emacs mode for Sublime Text

Sublemacs Pro - Emacs mode for Sublime Text

Postby grundprinzip on Sat Mar 16, 2013 3:27 pm

While Sublime Text is an awesome text editor the keybindings provided are not necessarily optimal for my workflow. After years of training my muscle memories to retain the movements and behavioral shortcuts of Emacs I still want to use Sublime but keep my productivity. Therefore I wrote Sublemacs which is an Emacs mode for Sublime as Vintage is an VI mode for Sublime.

It currently supports most of the Emacs shortcuts with the visual sugar of Sublime Text. For example it supports the following additions to the standard features of Sublime:

  • Kill line, region ... with kill ring. All the sugar you love with a nice UI with M-w, C-w, C-y
  • Yank with free choice from kill ring using fancy overlay: Just press M-Y to access the kill ring and search for your last copy and pastie
  • Rectangular cut and insert using C-x r t and C-x r d
  • Named registers to store data using C-x r s [register] and C-x r i [register]
  • Open a new line by C+o
  • C+s and C+r work like expected from Emacs with repeatedly pressing C+s for navigating to the next occurrence
  • C+g will try to exit any kind of overlays, exit snippet mode etc
  • tab for reindent and M+/ for auto completion
  • Using named registers for storing cursor positions across multiple views

And many more, most likely a key binding that you expect from Emacs will work as well in Sublemacs. Feel fre to checkout Sublemacs eihter directly from Github or install it via Package Control.

https://github.com/grundprinzip/sublemacspro

Installation: The easiest way to install is to first install Package Control (via http://wbond.net/sublime_packages/package_control) and then install the sublemacs package.

New:
  • Sublemacs supports both Sublime Text 2 and Sublime Text 3. If you have any recommendations for missing features from Emacs or request new features, feel free to drop me a line or open an issue on Github.
  • 03/18/2013 - added key bindings for macro recording and fixed a bug for ST3 where goto open file would not work as expected
  • 03/18/2013 - Paragraph Navigation is now available, but due to Mac compatibility bound to C-M [ and C-M ]
  • 04/11/2013 - Added point to register and jump to point from register, search box will now disappear as soon as the focus is lost
Last edited by grundprinzip on Thu Apr 11, 2013 2:30 pm, edited 3 times in total.
grundprinzip
 
Posts: 8
Joined: Wed Feb 20, 2013 7:47 pm

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby karljs on Sun Mar 17, 2013 7:58 pm

I've been using Sublemacs for a bit and am pretty impressed overall. Here are just a couple of things that I'd like to see added:

C-x 0 --- that's a zero, not the letter O, which deletes the current window.
M-z --- zap to char
M-{ and M-} --- forward/backward paragraph
C-x ( and C-x ) and C-x e --- Emacs-like macro keybindings
The Emacs macro counter!

Alter behavior of C-x C-f and C-x b to be a bit more like Emacs as follows (I do this on my machine)
C-x C-f --- I'd prefer this to just open the dialog for the file finder
C-x b --- Goto anything, which looks like a buffer list initially

Just a few things I've noticed in my short time trying it out. Some day maybe I'll have enough spare time to help out rather than just complain :D
karljs
 
Posts: 10
Joined: Fri Jun 22, 2012 5:33 am

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby grundprinzip on Mon Mar 18, 2013 10:19 am

Hi,

thanks for your ideas. I quickly implemented zap-to-char so that it should be available right when PackageControl updates your plugin. In addition I added the key bindings for macro recording. With regards to C-x b, this is already implemented and should work now both in ST3 and ST2 (there was bug preventing it from working correctly in ST3).

If I find some time, I will look at paragraph navigation, unfortunately for C-x 0 I have to disappoint you, this simply does not work the way as it is done in Emacs, since ST works with layout groups instead of explicit windows, might be there is a more complicated way, but for now using the standard defined C-x 1, C-x 2, C-x 3 and C-x 5 2 are the way to go.

Thanks for your support!
grundprinzip
 
Posts: 8
Joined: Wed Feb 20, 2013 7:47 pm

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby grundprinzip on Mon Mar 18, 2013 10:58 am

Paragraph Navigation is now available, but due to Mac compatibility bound to C-M [ and C-M ]
grundprinzip
 
Posts: 8
Joined: Wed Feb 20, 2013 7:47 pm

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby bretaarden on Thu Apr 04, 2013 5:58 pm

Hi.

The C+s key binding has similar behavior to Emacs, but when the search panel loses focus, I would expect that typing C+s would bring it back into focus (and select the search text) so that you could choose to continue the search (C+s again) or type to replace the search text.

That's what happens both in emacs and with the normal C+f in Sublime, but not with this package. I'm liking it otherwise!
bretaarden
 
Posts: 2
Joined: Thu Apr 04, 2013 5:52 pm

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby bretaarden on Fri Apr 05, 2013 5:56 pm

Ne'er mind. I discovered that C+g will cancel the current search, which is good enough for me.
bretaarden
 
Posts: 2
Joined: Thu Apr 04, 2013 5:52 pm

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby grundprinzip on Thu Apr 11, 2013 2:31 pm

I changed the behaviour to be more Emacs like and as soon as the focus is lost from the search box the panel will disappear. This had me annoyed already so it was a must have for me :)

Thanks for using sublemacs.
grundprinzip
 
Posts: 8
Joined: Wed Feb 20, 2013 7:47 pm

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby jsc on Tue Apr 23, 2013 4:35 am

On the topic of incremental search, the behavior of repeated C-r is busted. When you hit C-r and start typing, focus goes to the first previous occurrence of the search text, as expected. But when you hit C-r again, it goes to the next occurrence! And if you hit C-s, it goes to the previous occurrence.
jsc
 
Posts: 23
Joined: Wed Feb 20, 2013 2:24 am

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby grundprinzip on Tue Apr 23, 2013 12:22 pm

Hi JSC,

actually this is not Sublemacs fault, but ST's. You can validate this by opening the pristine find bar and manually clicking on the reverse button. If you then click on find it will basically find backwards, but if you click find previous it will go forward in the document. For now, I think I will make C-r open the find bar but ignore the direction so that C-r and C-s work as expected. I will post as soon as this is done.

Martin
grundprinzip
 
Posts: 8
Joined: Wed Feb 20, 2013 7:47 pm

Re: Sublemacs Pro - Emacs mode for Sublime Text

Postby jsc on Sun Apr 28, 2013 8:10 pm

One more suggestion, which I'm not sure is possible, but which would be swell to have:

When you use set mark (ctrl-spc) and select a region downwards, then use shift-meta-L to split into lines, the line with the mark retains its region when you move the cursor around. So if you want to, say, add a comma to every line by hitting C-e comma, the entire first line will be replaced with a comma.

Alternatively, if you set a mark and create a region upwards, split into lines, then hit C-a or C-e, the multiple selection disappears entirely and only the marked line has a cursor.

Maybe you could, I dunno, remove the mark in that case? Not entirely sure what is to be done.

One more weirdness with marks: set a mark near the end of a file, then hit alt-shift-> to go to end of buffer. Now type C-n and C-p (or up and down arrow) and note that the cursor can no longer move past the marked line.
jsc
 
Posts: 23
Joined: Wed Feb 20, 2013 2:24 am

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: Exabot [Bot] and 12 guests