this is how we use emacs:
Key:
C-
| hold control down for the next keystroke
|
M-
| hold alt down for the next keystroke OR
strike escape once then the key
middle-click
| on a 2-button mouse, you can 'middle-click'
by clicking both buttons at once.
| |
a few quick things:
When you are executing a command, watch the bottom of your emacs window.
That last line of text below the highlighted-line is very informative.
It's called the 'minibuffer', so keep that in mind.
opening/closing/saving etc
|
I want to:
| command
| notes
|
open a file
| C-x C-f
| in the minibuffer, you will type in the name and path of the file you want to open. tab completion works.
open a file from another server
| C-x C-f /USER@HOST:FILE
| uses an ftp connection to edit a file remotely. neat!
create a new file
| C-x C-f
| yes, the same command as open. just type in a path and name that you want the file to be.
save active file
| C-x C-s
| emacs auto-saves regularly with the filename and then a ~. this.java would be backed up as this.java~.
save all
| C-x s
| saves all modified buffers
save as / save under a new name
| C-x C-w
| you get to type in a new path and name in the buffer, like the open command!
exit/quit
| C-x C-c
| it will verify any unsaved open files in the minibuffer- so watch it.
| | | | | | |
editing
|
I want to:
| command
| notes
|
delete to the right
| delete
| backspace deletes to the left
undo what I just did!
alternate:
| C-_
C-x u
| multiple-undos is definitely supported. just keep hitting ctrl-shift-dash.
redo!
| move cursor and undo twice.
| it puts the undos on the stack of alterations. by breaking the repeated undos with a trivial cursor move, you allow yourself to undo the undos.
do a command X times
| C-NUMBEROFTIMES [return]
command
| some command (cut-line, for example) can be given a numerical argument like this. just hit ctrl- and a number, than do the command.
cut
| C-w
| cuts the highlighted text
copy
| automatic
| whatever the last thing you highlight in _any_ application is automatically copied.
paste
alternate paste command:
| C-y
middle-click
| clicking pastes where you click, not where the cursor is.
paste an old cut
| C-y M-y
| will cycle through old cuts and paste them in turn until you
stop hitting M-y.
cut next word
| M-d
| can then be pasted..
cut previous word
alternate:
| M-delete
M-backspace
| can be pasted.
cut this line
| C-k
| can be used in repetition to cut a lot of lines. can then be pasted as normal.
forward search
| C-s
| searches past the cursor for the next occurence of a string in the text.
next time you search the default will be to search for the same string.
backward search
| C-r
| searches above the cursor for the next occurence of a string.
Will default to last string searched for.
recover from backup
| M-x recover-file
| opens the last backup of the active file saved by emacs.
search/replace
| M-%
| eyes on the minibuffer. searches only below cursor.
search/replace with regexp
| C-M-%
| with regexp means it recognizes regular expression syntax. again, only below the cursor.
read in text file
| C-x i
| copies the text of a file in where your cursor is.
| | | | | | | | | | | | | | | | |
moving about
|
move to:
| command
| notes
|
up
down
left
right
| use
the
arrow
keys
| boy is that obvious.
try C-n, C-p, C-f, and C-b for a laugh.
beginning of line
| C-a
| yippy!
end of line
| C-e
| woohoo!
next word
| M-f
| or you could hit -> a few times..
previous word
| M-b
| gotta love recognition of the space character.
top of file
alternate:
| HOME
M-<
| life in the fast lane...
end of file
alternate:
| END
M->
| big surprise?
character number BLANK
| M-x goto-char
| the 'goto-char' is typed into the minibuffer.
after a return, you will be prompted for a number.
line number BLANK
| M-x goto-line
| the 'goto-line' is typed into the minibuffer.
after a return, you will be prompted for a number.
center on screen
| C-l
| makes the line the cursor is on centered & re-evaluates coloration.
switch to next visible buffer
| C-x o
| a buffer is any open document. for info on multiple buffers.. read on.
switch to named buffer
| C-x b BUFFERNAME
| buffernames include the names of the files you are editing, *scratch*, etc.
bring active buffer into this window
| C-x b
| an active buffer is any you've worked on already this session that you didn't explicitly close.
open buffer menu
| C-x C-b
| useful for seeing which buffers are open or active. listens to mouse clicks.
| | | | | | | | | | | | | |
buffers/windows/display
|
move to:
| command
| notes
|
color-code your code
| M-x global-font-lock-mode
| this feature is RAD. try it.
toggle line-number display
| M-x line-number-mode
| it's displayed on that line above the minibuffer. prefixed with an 'L'.
split screen horizontal
| C-x 2
| splits active buffer in half and allows you to see different files in each half.
split screen vertical
| C-x 3
| splits active buffer in half and allows you to see different files in each half.
close this screen partition
| C-x 0
| this would be used if you accidentally did more screen splits than you want. it kills the one you are in.
return to unified screen
| C-x 1
| makes whatever buffer you are in take up the entire display, hiding other open buffers.
create new window
| C-x 5 2
| opens up a new emacs window.
command prompt in emacs
| M-x shell
| gives you a shell in emacs. handy for compiling and viewing output.
switch to next visible buffer
| C-x o
| a buffer is any open document. for info on multiple buffers.. read on.
switch to named buffer
| C-x b BUFFERNAME
| buffernames include the names of the files you are editing, *scratch*, etc.
| | | | | | | | | |
getting help
|
move to:
| command
| notes
|
view the tutorial
| C-h t
| probably a good idea to go through this. it's not all as boring as the beginning.
can I see a list of key commands?
| C-h b
| it's a long list. check out the search commands.
what key does command X?
| C-h w
| you have to know what emacs calls the command... like 'font-lock-mode'.
what mode am I in?
| C-h m
| a little jargony. try it..
what does THIS key do, exactly?
| C-h k
| it will prompt you to strike a key and then tell you what command that key is currently bound to.
what does this key do, briefly?
| C-h c
| just like C-h k, but gives less info and puts it in the minibuffer rather than splitting your screen.
help, how do I use emacs HELP?
| C-h C-h
| lists a set of help topics and how to access them.
I just have some personal problems I need to talk about...
| M-x doctor
| though talking to a computer for help may seem futile, it is often suspected
that emacs is in fact an intelligence above and beyond our own. just give the
doctor a chance.
| | | | | | | |