⚡
usefultools.dev
vim

Vim-Spickzettel

NEU

Vim-Spickzettel mit Modi, Navigation, Bearbeiten, Suchen und Ersetzen, Textobjekten, Makros, Buffern und dem Speichern und Beenden (:wq, :q!, ZZ). Mit Suche und Kopieren per Klick.

Die Seite besteht aus statischem Text: Was du in den Filter tippst, verlässt deinen Browser nicht. Tasten, Befehle und ihre Kurzbeschreibungen werden auf Englisch angezeigt.

107 Einträge in 11 Abschnitten

Modes

Vim starts in Normal mode. Most keys below are typed in Normal mode unless a section says otherwise.

  • Esc or Ctrl-[

    Return to Normal mode from any other mode.

  • i

    Insert before the cursor.

  • a

    Insert after the cursor (append).

  • I

    Insert at the first non-blank character of the line.

  • A

    Insert at the end of the line.

  • o

    Open a new line below and start inserting.

  • O

    Open a new line above and start inserting.

  • v

    Start Visual mode: select characters.

  • V

    Start Visual Line mode: select whole lines.

  • Ctrl-v

    Start Visual Block mode: select a rectangle of columns.

  • R

    Replace mode: typed characters overwrite existing ones.

  • :

    Open the command line (Ex commands such as :w).

Moving around

  • h j k l

    Move left, down, up, right.

  • w / b

    Next word start / previous word start.

  • e

    Jump to the end of the word.

  • 0

    Start of the line.

  • ^

    First non-blank character of the line.

  • $

    End of the line.

  • gg

    First line of the file.

  • G

    Last line of the file.

  • 42G

    Go to line 42 (:42 does the same).

  • %

    Jump to the matching bracket, parenthesis or brace.

  • { / }

    Previous / next blank line (paragraph).

  • Ctrl-d / Ctrl-u

    Scroll half a page down / up.

  • fx

    Jump forward to the next "x" on the line; ; repeats, , reverses.

Editing

  • x

    Delete the character under the cursor.

  • rx

    Replace the character under the cursor with "x".

  • cw

    Change from the cursor to the end of the word (deletes it and starts inserting).

  • cc

    Change the whole line.

  • J

    Join the next line onto the current line.

  • >> / <<

    Indent / unindent the current line.

  • u

    Undo.

  • Ctrl-r

    Redo.

  • .

    Repeat the last change.

Delete, yank (copy), paste

Delete and change commands also store the text, so d then p works as cut and paste.

  • dd

    Delete (cut) the current line.

  • 3dd

    Delete three lines, starting at the current one.

  • dw

    Delete from the cursor to the start of the next word.

  • D

    Delete from the cursor to the end of the line.

  • yy

    Yank (copy) the current line.

  • p

    Paste after the cursor (or below, for whole lines).

  • P

    Paste before the cursor (or above, for whole lines).

  • ggdG

    Delete the entire file contents.

  • "+y

    Yank into the system clipboard (needs a Vim built with +clipboard); "+p pastes from it.

Search & replace

  • /pattern

    Search forward for pattern (a regular expression).

  • ?pattern

    Search backward for pattern.

  • n / N

    Next / previous match.

  • * / #

    Search forward / backward for the word under the cursor.

  • :noh

    Clear the search highlighting until the next search.

  • :s/old/new/g

    Replace every "old" on the current line (without g, only the first).

  • :%s/old/new/g

    Replace every "old" in the whole file.

  • :%s/old/new/gc

    Replace in the whole file and confirm each change (y / n / a / q).

  • :5,12s/old/new/g

    Replace only on lines 5 to 12.

  • :g/pattern/d

    Delete every line that matches the pattern.

Visual mode

Select with v, V or Ctrl-v, then apply an action to the selection.

  • ggVG

    Select the whole file.

  • gv

    Reselect the previous Visual selection.

  • > / <

    Indent / unindent the selected lines.

  • :'<,'>

    Pressing : in Visual mode fills this range in for you, so a command runs on the selected lines only.

  • Ctrl-v j j I# Esc

    Block insert: add "#" at the start of the selected lines (comment them out).

  • Ctrl-v j j $A; Esc

    Block append: add ";" at the end of every selected line.

Text objects

Use after an operator such as d, c, y or v: "i" means inside, "a" means around (including delimiters).

  • diw

    Delete the word under the cursor.

  • daw

    Delete the word and the space after it.

  • ci"

    Change the text inside double quotes.

  • ci(

    Change the text inside parentheses (cib is the same).

  • di{

    Delete everything inside curly braces.

  • cit

    Change the content inside an HTML/XML tag.

  • dap

    Delete a paragraph including its trailing blank line.

Registers, marks & macros

  • "ayy

    Yank the line into register a.

  • "ap

    Paste from register a.

  • :reg

    List the contents of all registers.

  • ma

    Set mark a at the cursor position.

  • 'a

    Jump to the start of the line with mark a.

  • `a

    Jump to the exact position of mark a.

  • Ctrl-o / Ctrl-i

    Jump back / forward through the jump list.

  • qa

    Start recording a macro into register a.

  • q

    Stop recording (when a recording is active).

  • @a

    Play macro a.

  • @@

    Repeat the last played macro.

Windows, tabs & buffers

  • :split or :sp

    Split the window horizontally.

  • :vsplit or :vs

    Split the window vertically.

  • Ctrl-w h/j/k/l

    Move to the window on the left / below / above / right.

  • Ctrl-w o

    Close every window except the current one.

  • :tabnew file

    Open a file in a new tab page.

  • gt / gT

    Go to the next / previous tab.

  • :ls

    List open buffers.

  • :bnext / :bprev

    Switch to the next / previous buffer.

  • :b 3

    Switch to buffer number 3.

Files & quitting

  • :w

    Save the file.

  • :q

    Quit (fails if there are unsaved changes).

  • :q!

    Quit and discard unsaved changes.

  • :wq

    Save and quit.

  • :x

    Save only if there are changes, then quit.

  • ZZ

    Same as :x, typed in Normal mode.

  • ZQ

    Same as :q!, typed in Normal mode.

  • :qa!

    Quit every window and discard all unsaved changes.

  • :e file.txt

    Open another file.

  • :e!

    Reload the file from disk and discard unsaved changes.

  • :w !sudo tee % > /dev/null

    Save a file you opened without root permission (Vim on Linux/macOS).

Useful settings

Type them after : to try them, or put them without the colon in ~/.vimrc to keep them.

  • :set number

    Show line numbers (:set nonumber hides them).

  • :set relativenumber

    Show line numbers relative to the cursor line.

  • :set ignorecase smartcase

    Case-insensitive search unless the pattern has a capital letter.

  • :set hlsearch incsearch

    Highlight matches and show them while typing.

  • :set expandtab tabstop=4 shiftwidth=4

    Use four spaces instead of tab characters.

  • :set wrap!

    Toggle line wrapping (a trailing ! toggles any on/off option).

  • :syntax on

    Turn on syntax highlighting.

  • :set clipboard=unnamedplus

    Use the system clipboard for yank and paste (needs +clipboard support).

  • :set paste

    Paste mode: stops auto-indent from mangling pasted text (:set nopaste to turn it off).

  • :help topic

    Open the built-in help, for example :help text-objects.

⚡

Schnelle Beispiele

Typische Eingaben und die Ergebnisse, die dieses Tool liefert.

Dateien
Speichern und beenden
:wq
Dateien
Beenden ohne zu speichern
:q!
Ersetzen
Jedes „old“ in der Datei durch „new“ ersetzen
:%s/old/new/g
Textobjekt
Den Text in doppelten Anführungszeichen ändern
ci"
📖

Überblick

Vim ist ein per Tastatur bedienter Texteditor, den du auf fast jedem Server findest. Er funktioniert anders als die meisten Editoren, weil er Modi hat. Dieser Vim-Spickzettel listet die Tasten und Befehle auf, die du am häufigsten brauchst: zwischen Normal-, Einfüge- und Visual-Modus wechseln, sich im Text bewegen, bearbeiten, löschen, kopieren und einfügen.

Außerdem behandelt er Suchen und Ersetzen, Textobjekte wie ci" und dap, Register, Marken und Makros, Fenster, Tabs und Buffer sowie die Möglichkeiten zum Speichern und Beenden. Eine kurze Liste nützlicher Einstellungen für deine .vimrc rundet die Seite ab. Tasten, Befehle und Kurzbeschreibungen bleiben auf Englisch; Oberfläche und diese Erklärung sind auf Deutsch. Filtere nach Stichwort und kopiere jeden Befehl mit einem Klick. Die Seite ist reiner Text, lädt schnell, und nichts, was du eingibst, verlässt deinen Browser.

Warum dieses Tool?

  • Eine vergessene Taste in Sekunden nachschlagen
  • Enthält alle Wege zum Speichern und Beenden, von :wq bis ZZ
  • Textobjekte und Makros in je einer Zeile erklärt
  • Nach Stichwort filtern, zum Beispiel replace, tab oder macro
  • Befehle und Einstellungen für deine .vimrc kopieren
⭐

Funktionen

🔍

Live-Filter

Gib ein Stichwort ein, um nur die passenden Tasten und Abschnitte zu sehen.

🚪

Vim beenden

:wq, :q!, :x, ZZ und ZQ sind in einem Abschnitt erklärt.

🎯

Textobjekte

Operatoren wie d, c und y, kombiniert mit inneren und äußeren Objekten.

🎬

Register und Makros

Mit q aufnehmen, mit @ abspielen und mehrere Zwischenablagen in Registern halten.

⚙️

Einstellungen für die .vimrc

Zeilennummern, Suchoptionen, Einrückung und Einstellungen für die Zwischenablage.

📱

Mobilfreundlich

Die Zeilen werden umgebrochen, damit der Spickzettel auch auf dem Smartphone lesbar bleibt.

🛠️

So funktioniert’s

1

Abschnitt wählen

Scrolle zu Moving around, Editing, Search & replace oder einer anderen Gruppe. Die Abschnittstitel sind auf Englisch.

2

Oder den Filter nutzen

Gib ein Wort wie „quit“ oder „macro“ in das Feld „Diesen Spickzettel filtern“ ein.

3

Modus prüfen

Die meisten Tasten funktionieren im Normal-Modus; drücke zuerst Esc und lies den Hinweis über jedem Abschnitt.

4

Bei Bedarf kopieren

Klicke auf Kopieren bei Einstellungen und Befehlen, die du in Vim oder deine .vimrc einfügen willst.

🤔

Häufig gestellte Fragen