The reasoning behind writing these set of functions is that we love Emacs, however, the UI doesn't feel as snappy as other Mac apps. On the other hand we cannot move to another editor since many of those hyped editors share that they don't provide the keybindings we love and embraced over time.
Then, we found Sublime Text. A completely customizable editor allowing you to easily modify all default behaviors so that they suit your editing style.
So, we wrote sublemacspro bringing Emacs keybindings and sugar to Sublime Text. Even though Emacs lives from the plugins, we believe it is way easier to write new plugins in Python and integrate them in an Emacs-ish way to Sublime Text than writing them in Lisp.
To install SublemacsPro you have to install Package
Control as an automatic
package manager for Sublime Text. Now you can easily install Sublemacs Pro and
your installation will never be outdated. When you installed Package Control,
hit S-Shift P
to open up the command palette and type install
. Now
select "Package Control: Install Package". This will load all packages from the
remote repository and you can select sublemacspro
from the drop-down list.
The main development for Sublemacs is now Sublime Text 3 only. However, there is still the branch using the earlier codebase for ST2.
https://github.com/grundprinzip/sublemacspro/tree/st2
If you encounter bugs or issues in the ST2 version, please report them, and we'll be happy to fix them.
The following features are supported and merged from other approaches and the base code of the new beta of Sublime Text 2.
ctrl+u
,meta+0
...meta+9
: Emacs universal argument - you provide a prefix arguments to a command to run it that many times. E.g.,meta+2
meta+3
ctrl+F
means go forward 23 characters.meta+f
andmeta+b
: Forward and backward words with the same exact behavior of emacs in terms of how you move.ctrl+meta+f
andctrl+meta+b
: Forward and backward s-expressions. It works for skipping over identifiers, strings and parentheses, braces and square brackets.meta+c
,meta+l
,meta+u
: capitalize, lower case, upper case words. They support numeric arguments, including negative arguments which means "do it to the previous N words".- Full emacs kill ring support:
- 64 entries - not currently adjustable
- adjascent kill commands are appended to the same entry
ctrl+w
andmeta+w
: kill and copy to the kill ring.ctrl+y
andmeta+y
: yank and yank-pop.- technically supplying a numeric argument to
ctrl+d
andBackspace
should append to the kill ring but I have not done that (yet). - The yank command will pull from the clipboard if it finds it is not the same as the current kill-ring entry, meaning you can go into a different app and copy something there and paste it into emacs using
ctrl+y
. Also, anything you kill in emacs will be placed on the clipboard for other apps to access.
meta+d
andmeta+Backspace
: Delete word forward and backward, placinging the deleted text on the kill ring.ctrl+meta+k
: Delete S-Expression and place on the kill ring. (Negative arguments not supported.)ctrl+k
: Kill to end of line mimics emacs almost exactly (it does not support a 0 numeric argument to delete to the beginning of the line). Providing a numeric argument means "delete that many lines" which is different from typingctrl+k
that many times.meta+<
andmeta+>
: move to beginning and end of file.meta+,
andmeta+.
: move to beginning and end of window.- Support for a emacs-style mark including the mark-ring:
ctrl+space
to push a new mark onto the ringctrl+x ctrl+x
to switch point and mark- Commands such as
ctrl+y
,meta+y
set the mark automatically as they do (and must) in emacs. meta+<
andmeta+>
also set the mark.- If you type
ctrl+space
twice in a row, it will activate the mark, which means "highlight it as a selection". It stays highlighted until you typectrl+g
or execute certain commands. - If you supply a numeric argument, e.g.,
ctrl+u ctrl+x ctrl+x
orctrl+u ctrl+space
, it will activate the mark without moving the cursor so you can see the current emacs region. - If you use the mouse to make a selection, it will set the mark and it will become the emacs region as well.
ctrl+o
: Open line.meta+g
: Goto line via numeric argument, e.g.,meta+4 meta+3 meta+5 meta+g
goes to line 435. (meta+g is not a great choice on Mac OS X I realize.)ctrl+l
: Center current line in view. With numeric argument, put the current line at the Nth line on the screen.meta+backslash
: Delete white space around point.ctrl+x 2
,ctrl+x 1
,ctrl+x d
,ctrl+x-o
: split window, delete all other windows, delete current window, go to other window.ctrl+s
andctrl+r
: proper emacs-style incremental search with Sublime Text multi-cursor extensions.- With a numeric argument
ctrl+u ctrl+s
does a regex search instead. - When you press
ctrl+s
immediately after the firstctrl+s
it will use the same search string as last time. - If you type any uppercase characters in your search, the search automatically becomes case-sensitive.
- While searching, each time you type
ctrl+s
you will skip ahead to the next match. - While searching,
meta+d
is likectrl+s
except the current match is kept as a future cursor (for when you finish the search). - If you change your mind about a
meta+d
orctrl+s
, you can pressBackspace
to undo it. - When you type
meta+a
all remaining matches from your current position to the end of the file (or beginning if you're doing a reverse search) are added to the kept matches. - When you type
Backspace
you are restored you to your previous search state. It will go back to a previous match or delete a character from your search string or remove the last kept match. - When you type
ctrl+w
while searching, the characters from your buffer are appended to your search string. - If your search is currently failing, you can type
ctrl+g
to go back to the last point your search was succeeding. If you typectrl+g
when your search is succeeding, the search is aborted and you go back to the start. - Clicking the mouse will end the search at the current location, as will opening an overlay.
- You can end your search by typing many regular emacs commands, e.g.,
ctrl+a
,meta+f
,ctrl+l
,meta+<
,meta+>
. - Press
Return
to end your search with all the kept items as multi-cursors. - When you complete (as opposed to abort) a search your mark is set to where you started from.
- With a numeric argument
- Rectangular cut and insert using
C-x r t
andC-x r d
alt+/
is used for tab completion sincetab
is bound to reindentalt+z
zap-to-char, delete from current point until next occurrence of characterctrl+x, ctrl+b
will present a list of open buffersctrl+x, (
andctrl+x, )
will toggle macro recording and execution is done byctrl+x, e
ctrl+alt+[
andctrl+alt+]
for paragraph navigation- Named registers to store data using
C-x r s [register]
andC-x r i [register]
ctrl+x r SPC r
for point-to-registerctrl+x r j r
for jump to point in registerctrl+x r s r
for text-to-registerctrl+x r i r
for insert text from register- And many more, most likely a key binding that you expect from Emacs will work as well in sublemacs
The key bindings are strictly oriented on their original Emacs counterpart, however, sometimes the action might be a little different due to other semantics.
We will try to extend this more and more to provide more features from Emacs to Sublime Text and make this my fast and beautiful Emacs replacement.
2012-2014 Martin Grund (@grundprinzip), Brian M. Clapper (@bmc), Jonathan Payne (@canoeberry)
- @dustym - focus groups
- @phildopus - for goto-open-file
- @aflc - toggle comment improvements
- @jinschoi - ST3 bugfix
- @mcdonc - inspiration for more Emacs key bindings