Beruflich Dokumente
Kultur Dokumente
<pre><code>
,---| emacs-stamp: Time-stamp: <2006-11-07 23:40:22 karl>
| vim-stamp: Latest change: Wed Apr 20 14:27:38 CEST 2011
| .... whichever comes last *ggg*
|
| Title:
vim7-emacs21-cheatsheet of freezing hell
|
... tries to combine the two editors of choice
|
| Author: Karl Voit
| Purpose: learning emacs21 _and_ vim (for myself)
| License: Creative Commons http://creativecommons.org/licenses/by/2.5/
| Status: constantly modified, updated, and expanded
`---Alternative cheatsheet: http://www.elmindreda.org/emacs.html
==============================================================================
==
Editor shortcuts: Emacs and vim
vim
emacs
==============================================================================
==
exit
save
save as
:q
:w
:w!
:w <path/name>
C-x C-c
C-x C-s
:wq
:q!
ESC
open file
file)
open file read only
re-read file (discard changes)
locate file
filter)
:e(dit) file
gf
undo
undo
undo
redo
undo
u
:u(ndo)
U
C-r
last changes
one change
latest changes on current line
changes since last save
(or: ZZ)
(or: ZQ)
or
C-c
C-g
C-x C-f
(find-
C-x C-r
:e(dit)!
M-x locate(-with-
a
A
(goto file)
(or: C-_)
C-_
or
C-x u
C-\
M-x revert-buffer
o
O
gv
y
yy
c
d
delete
delete
delete
delete
delete
delete
delete
x
dd
cw
caw
D
(column: C-v|C-q)
C-Space
M-h
char
line
to end of word
current word
to EOL
sentence
paragraph
delete previous
delete previous
delete previous
delete previous
paragraph
C-x i
character
word
sentence
paragraph
"yank"
(or: Y)
M-w
C-S-Backspace
C-y
C-y M-y
C-y M-y M-y
C-w
C-d
(or: :d<num>)
(change word)
or
DEL
M-d
C-k
M-k
M-x kill-paragraph
Backspace
M-Del
C-x Del
M-x backward-kill-
C-w
INS
r<char>
(or: R)
M-x overwrite-mode
X<cmd>
C-u X <cmd>
complete word
complete word backward
complete word forward
C-P
C-N
M-/
M-/
M-/
cancel
C-c
C-g
redraw
C-l
file info
file info (verbose)
C-g
g C-g
:set ai
:set textwidth=0
M-x auto-fill-mode
:r(ead) ! <cmd>
show whitespaces
:set list
insert <file>
:r(ead) <file>
M-x insert-file
:help XY
K
:helpg foobar
-----------------------------------------------------------------------Buffers
close buffer
close buffer and return to previous
close all buffers but current
buffers
enlarge current buffer
C-w c
:clo(se)
C-w o
:on(ly)
C-x k
C-x 0
M-x kill-someC-x 1
C-x C-f
C-x C-r
C-^
C-6
<12> C-^
<12> C-6
:b <12>
C-w s
:sp(lit)
C-w v
:vs(split)
duplicate buffer
:new
C-w h
C-w l
list buffers
:ls
:tabe(dit) fileA
gt
gT
C-x b
C-x b <XY>
--------------------------------------------------------------------Navigation
goto line <12>
Cursor movements
<12>G
up
left
right
down
buffer begin
C-f
C-f
j
1G
C-n
gg
M-<
buffer end
M->
0 ... $
^
word next
word last
w
b
M-f
M-b
sentence previous
sentence next
(
)
M-a
M-e
paragraph begin
paragraph end
{
}
M-{
M-}
C-o
C-i
'<
'>
page up
page down
C-b
C-f
1/2 page up
1/2 page down
C-u
C-d
C-e
C-y
m p
` p
``
`.
:marks
C-x r m
C-x r b
z.
C-l
M-v
C-v
line:
line:
line:
line:
goto character X
fC
goto character X backw. FC
go before character X
tC
go before char. X backw.TC
:set incsearch
(if activated) /
(if activated) ?
n
N
C-s
C-r
C-s or C-r
replace
s/foo/bar(/gci)
M-%
*
#
M-x occur
gd
gD
:noh
C-M-s
C-M-s
C-M-r
----------------------------------------------------------------------Spelling
activate spell checking
change spelling dictionary
search for next misspelled word
show correction proposals
add as correct word
add as incorrect word
:set spell
:set spelllang=de
]s
z=
zg
zf
--------------------------------------------------------------------Formatting
lowercase current word
capitalize current word
uppercase current word
toggle case of current word
toggle case of char under cursor
:map
:map
:map
:map
~
<esc>l
<esc>c
<esc>u
<esc>t
viwuW
viwu~W
viwUW
viw~W
quote text
format line
format paragraph
format whole document
gqap
gggqG
<<
>>
:set shiftwidth=4
M-l
M-c
M-u
C-c C-q
M-q
------------------------------------------------------------------------Macros
begin recording (name: foo)
end recording
qfoo
q
C-x (
C-x )
@foo
@@
C-x e
edit macro
end edit macro
"ap
save macro
-----------------------------------------------------------------------Columns
C-v
(Windows: C-q)
C-space
copy column(s)
paste column(s)
"yank"
cut column(s)
"kill"
"*y
p
C-x r y
C-x r k
C-x r t foo
-------------------------------------------------------------- Folding /
Outline
hide all
show all
toggle hide/show all
zC
zO
zi
C-c C-t
C-c C-a
hide this
show this
zc
zo
C-c C-d
C-c C-s
goto previous
goto next
zk
zj
C-c C-p
C-c C-n
------------------------------------------------------------- Special
Characters
enter carriage return
enter newline
enter spoiler character ^L
C-q ENTER
C-q C-j
C-q C-l
C-q ENTER
C-q C-j
C-q C-l
------------------------------------------------------ Compare/merge
differences
start file A and B in compare mode
vimdiff A B
emerge A B
C-c C-c f
e
next difference
previous difference
goto difference X
]c
[c
(C-c C-c) n
(C-c C-c) p
C-u X j
C-w h
C-w l
:[range]diffpu(t)
:[range]diffg(et)
dp
do
take A-version
take B-version
(C-c C-c) a
(C-c C-c) b
C-]
l
emacs: http://www.cs.cmu.edu/cgi-bin/info2www?(emacs)Merge%20Commands
---------------------------------------------------------------- Version
Systems
vim: install vcsnursery from http://www.vim.org/scripts/script.php?
script_id=1898
commit changes
show differences between versions
show log of current file
revert changes to most recent version
update current file from repos
:VCSCommit
:VCSVimDiff
:VCSLog
:VCSRevert
:VCSUpdate
C-x
C-x
C-x
C-x
v
v
v
v
v
=
l
u
:VCSAdd
:VCSAnnotate
:VCSDelete
:VCSDiff
:VCSReview 42
:VCSStatus
C-x v i
C-x v r
==============================================================================
==
Emacs specific shortcuts:
==============================================================================
==
execute single ELISP command:
increase font size
decrease font size
M-: cmd
C-x C-+
C-x C--
M-x delete-trailing-whitespace
(ucs-insert)
(move-to-window-line-top-
M-=
==============================================================================
==
vim specific shortcuts:
==============================================================================
==
==============================================================================
==
Own vim macros
==============================================================================
==
FIXXME: Bereichsangaben
" Using (g)vim to colorize sourcecode (from:
http://barnson.org/node/295#comment-26758)
" used here: Visual Basic syntax
:cal SetSyn("vb")
:syntax on
:set background=light
:runtime! syntax/2html.vim
ggVG (to select all in this top frame)
"+y (to copy to clipboard)
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
N O T E S
F O L L O W I N G
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
Svens Vortrag:
------------------------------------------------------------------------Suchen
------------------------------------------------------ Eingabe von
Sonderzeichen
Eingabe ber ASCII-Nummer:
223 228 246 252
Zwei-Zeichen-Kombination:
Digraph Input! a + : ->
automatische Einrcken (indenting)
Clipboards/Register
Markieren von Text
von Position bis Position
zeilenweise (block)
als Rechteck -> Tabelle
Zeile? DOS/Windows, Unix, oder Mac?
Automatische Erkennung
Beliebige Wahl
%page
Anzeige - Grundlegend
Aktuelle Position des Cursors (Lineal,ruler)
%pause
ASCII-Wert von Zeichen
%pause
Sichtbarmachung von speziellen Zeichen
(TABs, trailing spaces)
:set list -> schon oben drinnen
%pause
geteilte Fenster (horizontal,vertikal)
-> TextKopieren, Vergleiche
%page
Anzeige - Fortgeschritten
Syntax Coloring / Highlighting
%pause
Achtung: ersetzt keinen Parser!
%pause
Struktur der Datei anzeigen - Baumstruktur
Text verstecken
Syntax dependant
Kommandos zum Einklappen und Verstecken
%page
Abkrzungen - Abbreviations
%pause
einfache Wortexpansion:
LS -> Leutheuser-Schnarrenberger
%pause
mehrere Worte:
LT -> Linux-Tag Chemnitz
%pause
mehr als nur Buchstaben:
function_mit_viel_bedeutung(*par1,par2)
* = neue Cursorposition
%pause
mehrzeilige Floskeln:
Sehr geehrter Herr Spammer..
..Aufnahme ins Killfile..
Grnde: [Liste]
Mit freundlichen Gren
%page
Goodies
Autosave
Backup files
Compiler
Filtering
Sessionfile
Syntax Input
%page
Grenzen - Limits
Endlicher Speicher -> Grenzen
Dateigre
Dateinamenlnge
Displaybreite
Zeilenlnge
Zeilenanzahl
Bufferanzahl
Registergre
,---| 2do
`---tabs (vim7)
retab + ersetzen:
:set tabstop=4
:set expandtab
:%retab
^M herauslschen
align-current
query option value
:set OPTION?
C-c q
C-c w
http://www.gnu.org/software/auctex/manual/reftex.html
(require 'reftex)
M-x reftex-mode <RET>
C-c
C-c
C-c
C-c
C-c
=
(
)
[
&
(reftex-toc)
(reftex-label)
(reftex-reference)
BibTeX
(reftex-view-crossref)