Here is a more extensive and elaborate overview of useful shortcuts in the Emacs Editor. For a general reference to Emacs shortcut, check out this Emacs reference.
- C-g
- Abort current action
- C-h
- General help on emacs
- C-c C-d (C-c C-c)
- Interpret Selection (only if transient-mark-mode is on)
- C-c C-c
- Interpret current line
- C-c C-e
- Evaluate expression (in minibuffer)
- C-M-x
- Interpret defun
- C-c C-f
- Interpret current document
- C-c C-s
- Stop (CmdPeriod) / Main.stop
- C-c C-r
- Main.run
- C-c C-l
- Recompile library
- M-x sclang-stop
- Stop interpreter
- C-c C-p p
- Show server panels
- C-c C-w
- Switch to workspace
- C-c <
- Clear postbuffer
- C-c >
- Show postbuffer
- C-M-h
- Show help browser
- C-c C-h
- Open help file. You do not need to select a word before using the shortcut. It will suggest the word at the current cursor position, or lets you type a word in the minibuffer. There is autocompletion by typing <TAB>.
- E (in the help browser)
- open the help file as plain text (in sclang-mode), so it can be edited.
- C-c C-v (in the help browser)
- edit the help file as html code.
- C-c :
- Find definitions (method or class). Again, you can type the word you want to look for in the minibuffer and it suggests the word at the current cursor position.
- C-c ;
- Find references to (method or class). (ditto)
- C-c C-k
- Open current file at the svn development path location. You need to have set the devpath variable in Platform for this to work properly, e.g. thisProcess.platform.devpath = "~/svn/SuperCollider3".standardizePath;
- C-c [
- Dump interface
- C-c {
- Dump full interface
- C-c C-m / C-c RET
- Show method arguments (in minibuffer)
- C-c C-n / M-TAB
- Autocomplete keyword (either puts in the one possible completion, or pops up a buffer with possibilities from which you can choose one)
- C-x C-f
- Open file or new file
- C-x C-s
- Save file
- C-x C-w
- Save file as
- C-x C-v
- Open another file in this buffer
- C-x i
- Insert a file at cursor position
- C-x b
- Create/switch buffers
- C-x C-b
- Show buffer list
- C-x k
- Kill buffer
- C-z
- Suspend emacs
- C-x C-c
- Close down emacs
- C-x u / C-_
- Undo
- C-x u / C-_
- Redo
- M-x revert-buffer RETURN
- undo all changes since last save
- M-x recover-file RETURN
- Recover text from an autosave-file
- M-x recover-session RETURN
- Recover text from an autosave-files if you edited several files
- M-w
- Copy
- C-y
- Paste
- C-w
- Cut
- C-x C-o
- Delete blank lines
- C-s
- Search / find. This allows you to set a string in the mini-buffer. The occurrences in the text will be highlighted and you can press C-s again and again to jump to next occurrences
- C-r
- Search / find backwards.
- M-%
- Replace and find next
- M-,
- Replace
- M-g g
- Goto line ...
- C-x a
- Select all
- C-M-f
- zips you forward to matching parenthesis, so if you hover over the opening bracket, hit C-<space>, C-M-f, C-c C-c you can quickly execute a block.
- C-M-b
- zips you backward to matching parenthesis. If you are just to the right of closing brackets this is handier if you've just finished some code.
- C-f
- Move forward a character
- C-b
- Move backward a character
- M-f
- Move forward a word
- M-b
- Move backward a word
- C-n
- Move to next line
- C-p
- Move to previous line
- C-a
- Move to beginning of line
- C-e
- Move to end of line
- M-a
- Move back to beginning of sentence
- M-e
- Move forward to end of sentence
- M-x show-paren-mode
- Paren match highlighting. Can also be set from the options menu.
- M-;
- Add comment. If you have a text selected, then that text will become a comment. It will remove the commenting // when you have selected a commented text.
- C-M-j
- Continue the comment on the next line.
- C-u M-;
- Remove comment. This removes the whole comment, so also the text!
- M-x comment-region
- Comments the selected region
- M-x uncomment-region
- Uncomments the selected region
- TAB
- Auto-aligns tabs according to code.
(info from EmacsWiki)
A nice feature that not all know about is what happens if you feed it with a universal argument: ‘C-u C-SPC’. It’s an easy way to navigate back to your previous editing spots by jumping to the positions stored in the buffer’s local mark ring. Repeated calls will cycle through the ring of marks.
If you use TransientMarkMode and you want to set the mark but don’t want to subsequently see the region highlighting, you can use ‘C-SPC C-g’ to set the mark and then deactivate it.
In addition to the ordinary mark ring that belongs to each buffer, Emacs has a single global mark ring. It records a sequence of buffers in which you have recently set the mark, so you can go back to those buffers.
Setting the mark always makes an entry on the current buffer’s mark ring. If you have switched buffers since the previous mark setting, the new mark position makes an entry on the global mark ring also. The result is that the global mark ring records a sequence of buffers that you have been in, and, for each buffer, a place where you set the mark.
‘C-x C-SPC’ (‘pop-global-mark’) jumps to the buffer and position of the latest entry in the global mark ring. It also rotates the ring, so that successive uses of ‘C-x C-SPC’ take you to earlier and earlier buffers.
You can customize the behaviour of Emacs, by putting things in the startup file of emacs. This file is ~/.emacs
. You can define options there, for example:
nil means that an option is turned off, t or 1 means that it is turned on.
Configure the text cursor NOT to move after hitting C-c C-c
Normally w3m uses the arrow keys to jump between hyperlinks. For browsing SC help files this is not very useful.
Recentf is a minor mode that builds a list of recently opened files. This list is automatically saved across Emacs sessions. You can then access this list through a menu. Put this in your `~/.emacs’:
For adding a shortcut (C-x C-r) to open a recent file add this code as well:
See the Emacs Wiki