From Eclipse to Emacs
I am trying to learn Emacs after about a year of using Eclipse 3.2/3.3. See this post for some reasons why. Below is a list of Eclipse keyboard shortcuts and their Emacs equivalents. I'm using Emacs 22.1 for Windows.
Update 2009-07-20: After almost 2 years, I am still happily using Emacs (now Emacs 23 on Ubuntu). I made a few small corrections/updates to the table below.
| ECLIPSE COMMAND | SIMILAR EMACS COMMAND (Emacs manuals use C for the CTRL key and M for the Meta or Alt key. So, e.g. C-x means CTRL+X. For Emacs long commands, you can type TAB to complete the command name.) |
| Cancel a command ESC |
Cancel a command C-g |
| Open resource CTRL+SHIFT+R |
Find file Keybinding: C-x C-f Command: M-x find-file Notes: Type in the file to open. Hit TAB for filename completion. Hit up and down arrows for recently used files. |
|
Save file CTRL+S |
Save buffer Keybinding: C-x C-s Command: M-x save-buffer |
|
Save As |
Write file Keybinding: C-x C-w Command: M-x write-file |
| Close CTRL+F4 |
Unlike Eclipse, Emacs' buffers and windows are distinct so closing a buffer and closing a window require separate commands. Kill this bufferKeybinding: C-x k Command: M-x kill-this-buffer Delete window Keybinding: C-x 0 Command: M-x delete-window |
| Undo/Redo CTRL+Z / CTRL+Y |
Undo/ Undo Undo Keybinding: C-_, C-x u, C-/ Command: M-x undo To redo, interrupt the undo sequence by entering any command (e.g. C-f), then undo again. This undoes what you just undid, which is like redo. See 21.1 Undo in the GNU Emacs Manual. This behavior can be confusing so there is also a RedoMode which behaves more like Eclipse and other editors. See RedoMode on the Emacs Wiki. |
| Switch editors Keybinding: CTRL+F6 or CTRL+SHIFT+F6 Command: CTRL+3 Next Editor or CTRL+3 Previous Editor |
Switch buffers Keybinding: C-x RIGHTARROW or C-x LEFTARROW See also: 24 Using Multiple Buffers in the Emacs Manual |
| Switch views Keybinding: CTRL+F7 or CTRL+SHIFT+F7 Command: CTRL+3 Next View or CTRL+3 Previous View |
After splitting into 2 windows with C-x 2, use C-x o to switch between windows. To scroll the other window, use C-M-v. This is useful to reference one window while editing in the other. To close the other window, type C-x 1 in the window you want to keep. |
| Find and Replace Keybinding: CTRL+F |
Incremental Search Keybinding: C-s Unconditional Replace Command: M-x replace-string RET string RET newstring RET Regexp Replacement Command: M-x replace-regexp RET regexp RET newstring RET See also: 20.9 Replacement Commands |
|
Show line numbers Keybinding: none Command: CTRL+3 Show Line Numbers |
Linum (Emacs >= 23 only) Keybinding: none Command: M-x linum-mode For Emacs <= 22, look in your status bar for the line number or see http://www.emacswiki.org/cgi-bin/wiki/LineNumbers |
| Code Completion Keybinding: CTRL+SPC |
Dynamic Abbrev Expansion Keybinding: M-/ Command: M-x dabbrev-expand This command is much faster and simpler than Eclipse because it doesn't use the compiler/interpreter. However, I think it is less robust for the same reason. At this point, I think I like the Eclipse version better. See also 34.6 Dynamic Abbrev Expansion in the manual. |
| Keys Command: CTRL+3 Keys - General |
Key Bindings Keybinding: C-h b Command: M-x describe-bindings |
| Comment Keybinding: CTRL+/ |
Comment DWIM (Do What I Mean) Keybinding: M-; Command: M-x comment-dwim |
| Shift Right (or Left) Keybinding: TAB (SHIFT+BACKSPACE) |
Shift Region Right (or Left) Keybinding: C-c > (C-c <) Command: ??? Note: This doesn't work if you're in CUA mode (i.e. using C-x/C-c/C-v Cut and Paste) |
| Find text in Workspace Keybinding: CTRL+ALT+G Command: Find Text in Workspace |
grep (and variants) Command: M-x lgrep RET string RET filepattern RET directory RET. See also 32.4 Searching with Grep under Emacs I still miss this one in Eclipse. grep has more power than Eclipse, but the combination of pretty highlighting and searching across files is nice in Eclipse. I have created an Elisp function to at least grep for selected text with one key stroke. Put the following in your .emacs and you'll get something similar to CTRL+ALT+G in Eclipse. ;; my eclipse CTRL+ALT+G replacement
(defun grep-selected (start end)
(interactive "r")
(grep (concat "grep -nH -e "
(buffer-substring start end)
" * .*"))
(global-set-key "\C-\M-g" 'grep-selected)
I am just learning to customize emacs with Elisp so I'm sure there are improvements that can be made. |
4
Comments
—
Comments feed for this post
Post a comment
About
I'm Eliot and this is my notepad for programming topics such as Python, Django, Ubuntu, Emacs, etc... more »
Search Blog
Tags
-
algorithms
(4)
-
aws
(8)
-
blogproject
(20)
-
c_cplusplus
(12)
-
cardstore
(8)
-
colinux
(2)
-
concurrency
(9)
-
conkeror
(2)
-
cygwin
(18)
-
datastructures
(15)
-
datetime
(3)
-
dell
(3)
-
django
(39)
-
emacs
(20)
-
files_directories
(10)
-
install_setup
(7)
-
javascript
(3)
-
keyboard
(6)
-
matplotlib
(5)
-
mercurial
(4)
-
nginx
(2)
-
preferences
(8)
-
processes
(3)
-
pyqt
(18)
-
python
(122)
-
ratpoison
(3)
-
regexes
(5)
-
rsync
(3)
-
softwaretools
(17)
-
sql
(13)
-
ssh
(7)
-
subversion
(6)
-
twisted
(6)
-
ubuntu
(60)
-
urxvt
(5)
-
vxworks
(25)
-
webservices
(4)
-
wmii
(7)
Blogroll
- Adam Gomaa
- Alex Clemesha
- Amir Salihefendic
- Armin Ronacher
- David Beazley
- David Ziegler
- Duncan McGreggor
- Gareth Rushgrave
- Glyph Lefkowitz
- Guido van Rossum
- Ian Bicking
- Jacob Kaplan-Moss
- James Bennett
- James Tauber
- Jesper Noehr
- Matt Harrison
- Nikolay Kolev
- Parand Darugar
- Peter Baumgartner
- Peter Bengtsson
- Rob Hudson
- Simon Willison
- Will McGugan
#1 Konstantin commented on 2008-09-30:
For a code completion the Eclipse has the same functionality like emacs ,Hippy competition (keybinding is "Alt +/").