|
:set nu
show line numbers.
:set ic
ignore case differences when searching.
:set ai
set automatic indent.
:set sm
show matching ( or { with ) or } in insert mode.
down-arrow up-arrow
move down/up 1 line.
right-arrow left-arrow
move right/left 1 character column.
0 $
go to 1st/last column of current line.
return
go down to 1st printable character of next line.
nw nb
move right/left n words (1 word if n omitted).
ng
go to line n (end of file if n omitted).
ctrl-f ctrl-b
page forward/backward 1 screen.
ctrl-d ctrl-u
page forward/backward half a screen.
[[ ]]
go to beginning of current/next c function.
/expressionreturn
search forwards for expression.
?expressionreturn
search backwards for expression.
n n
repeat last / or ? command in same/reverse direction.
ytarget
copy (yank) text up to target to buffer.
y
copy current line to buffer.
itextesc
insert text before cursor.
otextesc
open new line below cursor and insert text.
r
replace character under cursor with next typed.
rtextesc
replace text.
backspace
in insert mode, delete character before cursor.
x x
delete character under/before cursor.
nx
delete n characters under and to right of cursor.
nx
delete n characters before cursor.
dd
delete current line.
ndd
delete n lines.
d
delete from cursor to end of line.
p p
put back yanked or deleted text below/above current line.
j
join current and next lines.
:m,n s/old/new/gc
global replace (g=every occurrence on line, c=prompt);
m=.
means from current position, n=$ means to eof.
u
undo last change.
:q
quit, provided no changes were made.
:q!
quit without saving.
:w
save (write) changes.
:m,n w file
save lines m through n (default=all) to file.
:x
save changes and quit.
this guide is intended for gnu emacs where commands associated with buffer, file and help operations are obtained by clicking the relevant menu bar item with the left mouse button, and selecting the operation from the drop-down menu. also "copy", "cut" and "paste" operations are performed by dragging over the text with the left mouse button down, using the edit drop-down menu to select "copy" or "cut", then identifying the insertion point with the left mouse button, and finally selecting "paste" from the edit menu to retrieve the text. emacs has a vast range of commands, this is just a very brief personal selection of the ones i use most often. down-arrow up-arrow move down/up 1 line. right-arrow left-arrow move right/left 1 character column. alt-f move forwards one word. alt-b move backwards one word. ctrl-e go to end of line. ctrl-a go to beginning of line. alt-> go to end of file. alt-< go to beginning of file. ctrl-v go down one screenful. alt-v go up one screenful. ctrl-l centre current line. alt-x goto-line n go to line number n. ctrl-s incremental search forwards. ctrl-r incremental search backwards. alt-% global replace with prompt. ctrl-g cancel current operation. backspace or del delete character before cursor. ctrl-d delete character under cursor. ctrl-k delete to end of line or delete blank line. ctrl-_ undo last change. ctrl-c ctrl-r column numbers (fortran mode only - starts at 0!). ctrl-x 2 split window into two. ctrl-x 1 back to one window. alt-x shell start shell in emacs window.
|