---
title: "Vim"
lang: "en"
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/vim
---

[Home](/)›[Cheatsheets](/cheatsheets)

Cheatsheets

# Vim

Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as "vi" with most UNIX systems.

7 Categories27 Sections57 ExamplesPublished: 01 Mar 2023Updated: 27 Feb 2025

EditorVimText EditorTerminalProductivityKeyboard Shortcuts

[Markdown for AI(opens in a new tab)](/vim/index.md "Open the plain-Markdown version of this page, for pasting into an AI tool")

Series

[Developer Environment & Tooling](/series/developer-environment--tooling)4/6

[PreviousTmux](/cheatsheets/tmux)[NextVS Code](/cheatsheets/vscode)

All posts in this series (6)

Cheatsheets6

1.  [Git](/cheatsheets/git)
2.  [Screen](/cheatsheets/screen)
3.  [Tmux](/cheatsheets/tmux)
4.  [VimYou are here](/cheatsheets/vim)
5.  [VS Code](/cheatsheets/vscode)
6.  [Python Virtual Environments Cheatsheet](/cheatsheets/python-venv)

Vim is a highly configurable text editor built to make creating and changing any kind of text very efficient. It is included as “vi” with most UNIX systems.

The sections below cover Vim commands, shortcuts, and examples.

[Getting Started](#category-getting-started)

-   [Modes](#section-modes)
-   [Exiting](#section-exiting)
-   [Opening Files](#section-opening-files)

[Navigation](#category-navigation)

-   [Basic Movement](#section-basic-movement)
-   [Document Movement](#section-document-movement)
-   [Search Movement](#section-search-movement)
-   [Marks and Jumps](#section-marks-and-jumps)

[Editing](#category-editing)

-   [Inserting Text](#section-inserting-text)
-   [Clipboard Operations](#section-clipboard-operations)
-   [Undo and Redo](#section-undo-redo)
-   [Find and Replace](#section-find-and-replace)

[Operators and Text Objects](#category-operators-and-text-objects)

-   [Operators](#section-operators)
-   [Text Objects](#section-text-objects)
-   [Repeating](#section-repeating)

[Visual Mode](#category-visual-mode)

-   [Visual Selection](#section-visual-selection)
-   [Visual Operations](#section-visual-operations)
-   [Visual Block](#section-visual-block)

[Windows and Tabs](#category-windows-and-tabs)

-   [Split Windows](#section-split-windows)
-   [Tab Pages](#section-tab-pages)
-   [Buffers](#section-buffers)

[Advanced Features](#category-advanced-features)

-   [Macros](#section-macros)
-   [Registers](#section-registers)
-   [Folds](#section-folds)
-   [Spell Checking](#section-spell-checking)
-   [Command-Line Tricks](#section-command-line-tricks)
-   [Options and Settings](#section-options-and-settings)
-   [Redirection and Pipes](#section-redirection-and-pipes)

No commands found

Try adjusting your search term

## Getting Started

Fundamental Vim concepts including modes, exiting, and opening files.

### Modes

Vim operates in several modes. Knowing which mode you are in determines what every keystroke does.

#### Accessibility

Mode indicators should be clearly announced for screen reader users.

#### Best Practices

-   Always return to Normal mode (Esc) before executing motion or operator commands.
-   Learn to think in terms of mode transitions rather than just key presses.
-   Use the mode indicator at the bottom of the screen to confirm your current mode.

#### Common Errors

-   **Typing text in Normal mode instead of Insert mode:** Press i to enter Insert mode before typing text.
-   **Forgetting to leave Insert mode before issuing commands:** Press Esc to return to Normal mode, then issue the command.

#### Advanced Notes

-   **Replace Mode:** Press R to enter Replace mode, which overwrites characters as you type.
-   **Select Mode:** Press gh to enter Select mode, similar to selection in other editors.

#### Keywords

modenormalinsertvisualcommandescape

[Learn more](https://vimhelp.org/intro.txt.html#vim-modes)

#### Entering Insert mode

These keys transition from Normal mode to Insert mode at various cursor positions.

Code

```
1i    " Insert before cursor2a    " Insert after cursor3o    " Open new line below and enter Insert mode4O    " Open new line above and enter Insert mode5I    " Insert at beginning of line6A    " Insert at end of line
```

-   Press Esc at any time to return to Normal mode.
-   i and a are the most commonly used: i inserts before cursor, a inserts after.

#### Entering Visual mode

Visual mode lets you select text for operations like copy, delete, or indent.

Code

```
1v      " Character-wise Visual mode2V      " Line-wise Visual mode3Ctrl-V " Block-wise Visual mode
```

-   Use V to select entire lines quickly.
-   Ctrl-V handles column editing.

#### Entering Command-line mode

Command-line mode is where you execute Ex commands, search, and filter text.

Code

```
1:    " Enter Command-line mode2/    " Enter search forward3?    " Enter search backward
```

-   Press Esc or Ctrl-C to cancel and return to Normal mode.
-   Use Tab for command completion in Command-line mode.

### Exiting

How to save files and exit Vim.

#### Accessibility

Exit confirmations should be clearly communicated.

#### Best Practices

-   Use :x or ZZ instead of :wq to avoid unnecessary writes.
-   Save frequently with :w to avoid losing work.
-   Use :wa before running external build commands.

#### Common Errors

-   **E37: No write since last change:** Use :w to save first, or :q! to discard changes.
-   **E45: 'readonly' option is set:** Use :w! to force write, or :w newfilename to save elsewhere.

#### Keywords

quitsaveexitwriteclose

[Learn more](https://vimhelp.org/editing.txt.html#write-quit)

#### Save and quit

These commands write the buffer to disk and/or close Vim.

Code

```
1:w     " Save (write) the file2:q     " Quit (fails if unsaved changes)3:wq    " Save and quit4:x     " Save and quit (only writes if changes exist)5ZZ     " Save and quit (Normal mode shortcut)
```

-   :x and ZZ only write if the buffer has been modified, preserving file timestamps.
-   :wq always writes, even if no changes were made.

#### Quit without saving

Force-quit commands discard unsaved changes. Use with caution.

Code

```
1:q!    " Quit without saving (force quit)2ZQ     " Quit without saving (Normal mode shortcut)3:qa!   " Quit all windows without saving
```

-   The ! modifier forces the operation, bypassing safety checks.
-   :qa! is useful when you have multiple buffers/windows open.

#### Save all and quit

Multi-buffer save and quit commands for working with several files at once.

Code

```
1:wa    " Save all modified buffers2:wqa   " Save all buffers and quit3:xa    " Save all modified buffers and quit
```

-   :wa saves all buffers but keeps Vim open.
-   :wqa and :xa close Vim after saving everything.

### Opening Files

Different ways to open files in Vim from the command line.

#### Accessibility

File paths and buffer names should be announced clearly.

#### Best Practices

-   Use tab completion when opening files from within Vim.
-   Use splits for comparing or referencing related files.
-   Use :e with wildcards for quick file switching.

#### Common Errors

-   **E325: ATTENTION - Found a swap file:** Choose (R)ecover to recover, or (D)elete to discard the swap file.
-   **Opening a directory instead of a file:** Vim opens the netrw file explorer for directories. Use :e filename to open a specific file.

#### Keywords

openfileeditsplittabcommand line

[Learn more](https://vimhelp.org/starting.txt.html#starting)

#### Basic file opening

Open files directly from the shell with optional line or pattern positioning.

Code

```
1vim file.txt          " Open a file2vim +42 file.txt      " Open file at line 423vim +/pattern file.txt " Open file at first match of pattern
```

-   The + flag accepts any Ex command to run after opening.
-   Use vim + file.txt to open at the last line.

#### Opening multiple files

Open multiple files in different layouts directly from the command line.

Code

```
1vim file1.txt file2.txt   " Open in buffers (:bn to switch)2vim -O file1.txt file2.txt " Open in vertical splits3vim -o file1.txt file2.txt " Open in horizontal splits4vim -p file1.txt file2.txt " Open in tabs
```

-   Use -O for side-by-side editing of related files.
-   Use -p for tab-based workflow.

#### Opening files from within Vim

Open additional files without leaving Vim using Ex commands.

Code

```
1:e file.txt     " Edit a file in current window2:sp file.txt    " Open in horizontal split3:vsp file.txt   " Open in vertical split4:tabe file.txt  " Open in new tab
```

-   :e replaces the current buffer; use :bn to go back.
-   Tab-complete file paths with Tab in command mode.

## Navigation

Moving efficiently through files and text in Vim.

### Basic Movement

Fundamental cursor movement commands in Normal mode.

#### Accessibility

Cursor position changes should be trackable by assistive technologies.

#### Best Practices

-   Use hjkl instead of arrow keys to keep hands on the home row.
-   Combine number prefixes with motions for faster movement (e.g., 10j).
-   Prefer word motions (w, b, e) over repeated h/l for horizontal movement.

#### Common Errors

-   **Using arrow keys instead of hjkl:** Practice with hjkl; consider disabling arrow keys in your vimrc to build the habit.
-   **Pressing j/k repeatedly instead of using counts:** Use a count prefix like 8j to jump 8 lines at once. Enable :set relativenumber to see line offsets.

#### Keywords

movecursornavigationhjklwordline

[Learn more](https://vimhelp.org/motion.txt.html#left-right-motions)

#### Character and line movement

The h/j/k/l keys replace arrow keys for efficient navigation without leaving the home row.

Code

```
1h  " Move left2j  " Move down3k  " Move up4l  " Move right50  " Jump to beginning of line6^  " Jump to first non-blank character7$  " Jump to end of line
```

-   Use 0 for absolute start, ^ for first non-whitespace character.
-   Prefix with a number for repeated movement (e.g., 5j moves down 5 lines).

#### Word movement

Word motions navigate by word boundaries. Lowercase variants treat punctuation as word boundaries; uppercase variants only use whitespace.

Code

```
1w   " Move forward to start of next word2b   " Move backward to start of previous word3e   " Move forward to end of current/next word4ge  " Move backward to end of previous word5W   " Move forward to start of next WORD (space-delimited)6B   " Move backward to start of previous WORD7E   " Move forward to end of next WORD
```

-   Use w/b for precise navigation around punctuation.
-   Use W/B for faster navigation across mixed text.

### Document Movement

Commands for navigating through the entire document quickly.

#### Accessibility

Screen position after scrolling should be clearly communicated.

#### Best Practices

-   Use gg and G to quickly move to file boundaries.
-   Prefer Ctrl-D/Ctrl-U over Ctrl-F/Ctrl-B for more controlled scrolling.
-   Combine :n with navigation to jump to specific line numbers.

#### Common Errors

-   **Losing track of cursor position after large jumps:** Use Ctrl-O to jump back to the previous position. Enable :set cursorline for visibility.
-   **Scrolling past the target:** Use Ctrl-D/Ctrl-U (half-page) for finer control than Ctrl-F/Ctrl-B (full page).

#### Keywords

scrollpagejumptopbottomdocument

[Learn more](https://vimhelp.org/motion.txt.html#scroll)

#### Jumping to document positions

Jump directly to specific lines or screen positions.

Code

```
1gg     " Go to first line of document2G      " Go to last line of document3:42    " Go to line 42442G    " Go to line 42 (Normal mode)5H      " Move to top of screen (High)6M      " Move to middle of screen (Middle)7L      " Move to bottom of screen (Low)
```

-   gg and G are the quickest way to jump to the top or bottom.
-   H/M/L position the cursor on the visible screen area.

#### Scrolling

Scroll the viewport while maintaining or moving the cursor.

Code

```
1Ctrl-D " Scroll down half a page2Ctrl-U " Scroll up half a page3Ctrl-F " Scroll down a full page (Forward)4Ctrl-B " Scroll up a full page (Backward)5Ctrl-E " Scroll down one line6Ctrl-Y " Scroll up one line
```

-   Ctrl-D and Ctrl-U are the most commonly used scroll commands.
-   Ctrl-E and Ctrl-Y scroll without moving the cursor line.

### Search Movement

Finding text and navigating by search patterns and character jumps.

#### Accessibility

Search results and match highlights should be announced.

#### Best Practices

-   Use \* and
-   Use f/t for precise in-line jumps rather than repeated w or l.
-   Enable incremental search with :set incsearch.

#### Common Errors

-   **Search wraps around unexpectedly:** Use :set nowrapscan to prevent search from wrapping around the file.
-   **Regex characters interfering with search:** Escape special regex chars with backslash, or use \\V for very-nomagic (literal) search.

#### Keywords

searchfindpatternnextpreviouscharacter

[Learn more](https://vimhelp.org/pattern.txt.html#search-commands)

#### Pattern searching

Search for text patterns in the file. Vim supports regular expressions in search.

Code

```
1/pattern   " Search forward for pattern2?pattern   " Search backward for pattern3n          " Repeat search in same direction4N          " Repeat search in opposite direction5*          " Search forward for word under cursor6#          " Search backward for word under cursor
```

-   Use :set hlsearch to highlight all matches.
-   Press :noh to clear search highlighting.

#### Character-level jumps

Jump to specific characters on the current line. Useful for precise horizontal navigation.

Code

```
1f{char}  " Jump forward to next occurrence of {char}2F{char}  " Jump backward to previous occurrence of {char}3t{char}  " Jump forward to just before {char}4T{char}  " Jump backward to just after {char}5;        " Repeat last f/F/t/T in same direction6,        " Repeat last f/F/t/T in opposite direction
```

-   f and t are among the most efficient ways to move within a line.
-   Combine with operators like d or c (e.g., dt) to delete/change up to a character).

### Marks and Jumps

Setting bookmarks and navigating the jump list.

#### Accessibility

Mark positions should be clearly described.

#### Best Practices

-   Use uppercase marks (mA) for frequently visited locations across files.
-   Use Ctrl-O liberally to retrace your steps after jumping around.
-   Combine marks with operators (e.g., d'a deletes from cursor to mark a).

#### Common Errors

-   **Mark not set or overwritten:** Use :marks to check existing marks before setting new ones. Choose consistent mark naming conventions.
-   **Confusing backtick and single quote jumps:** Backtick (\`) jumps to the exact position; quote (') jumps to the start of the marked line.

#### Keywords

markbookmarkjumppositionnavigate

[Learn more](https://vimhelp.org/motion.txt.html#mark-motions)

#### Setting and jumping to marks

Marks let you bookmark positions in a file and jump back to them.

Code

```
1ma       " Set mark 'a' at current position2'a       " Jump to line of mark 'a'3`a       " Jump to exact position of mark 'a'4:marks   " List all marks5''       " Jump to position before last jump (line)6``       " Jump to position before last jump (exact)
```

-   Lowercase marks (a-z) are local to a buffer; uppercase marks (A-Z) are global across files.
-   Use \` (backtick) for exact column position, ' (single quote) for line start.

#### Jump list navigation

The jump list tracks your movement history. Use Ctrl-O/Ctrl-I to go back and forth.

Code

```
1Ctrl-O   " Jump to older position in jump list2Ctrl-I   " Jump to newer position in jump list3:jumps   " Show the jump list
```

-   Searches, marks, and line jumps are all recorded in the jump list.
-   Ctrl-O is one of the most useful navigation shortcuts in Vim.

## Editing

Commands for inserting, copying, pasting, and transforming text.

### Inserting Text

Various ways to enter Insert mode and begin typing.

#### Accessibility

Mode changes should be clearly indicated.

#### Best Practices

-   Use A to append at line end instead of $a.
-   Use S to replace an entire line rather than dd followed by O.
-   Use r for single character fixes to stay in Normal mode.

#### Common Errors

-   **Accidentally entering Replace mode with R:** Press Esc immediately to return to Normal mode. Use u to undo any overwrites.
-   **Using s when meaning to save:** s substitutes characters. Use :w to save the file.

#### Keywords

insertappendopensubstitutechangereplace

[Learn more](https://vimhelp.org/insert.txt.html#inserting)

#### Basic insert commands

Each command enters Insert mode at a different position relative to the cursor or line.

Code

```
1i  " Insert before cursor2I  " Insert at beginning of line3a  " Append after cursor4A  " Append at end of line5o  " Open new line below6O  " Open new line above
```

-   A is especially useful for adding content to the end of a line.
-   o and O are preferred over pressing Enter manually.

#### Substitute and replace

These commands combine deletion with entering Insert or Replace mode.

Code

```
1s  " Delete character under cursor and enter Insert mode2S  " Delete entire line and enter Insert mode3C  " Delete from cursor to end of line and enter Insert mode4r  " Replace single character (stays in Normal mode)5R  " Enter Replace mode (overwrite characters)
```

-   s is equivalent to cl (change one character).
-   R is useful for fixed-width editing or overwriting text in place.

### Clipboard Operations

Deleting, yanking (copying), and putting (pasting) text.

#### Accessibility

Clipboard content changes should be announced.

#### Best Practices

-   Use dd and p together for moving lines.
-   Use the named registers ("ay, "ap) for storing multiple clipboard items.
-   Use "+y to copy text for use outside of Vim.

#### Common Errors

-   **Pasted text goes to wrong position:** Use p to paste after cursor, P to paste before. For lines, p pastes below, P above.
-   **System clipboard not working:** Check if Vim has clipboard support with :version and look for +clipboard. Install vim-gtk or gvim if needed.

#### Keywords

yankcopypasteputdeletecutclipboardregister

[Learn more](https://vimhelp.org/change.txt.html#deleting)

#### Delete and yank commands

Delete commands cut text into a register. Yank commands copy without deleting.

Code

```
1x     " Delete character under cursor2X     " Delete character before cursor3dd    " Delete (cut) entire line4D     " Delete from cursor to end of line5yy    " Yank (copy) entire line6Y     " Yank entire line (same as yy)7d{motion} " Delete text covered by motion (e.g., dw, d$)8y{motion} " Yank text covered by motion (e.g., yw, y$)
```

-   Deleted text is stored in the unnamed register and can be pasted with p.
-   Use d$ or D to delete from cursor to end of line.

#### Put (paste) and system clipboard

Put commands paste text from registers. The + and \* registers access the system clipboard.

Code

```
1p     " Put (paste) after cursor2P     " Put (paste) before cursor3"+y   " Yank to system clipboard4"+p   " Paste from system clipboard5"*y   " Yank to primary selection (X11)6"*p   " Paste from primary selection (X11)
```

-   Vim must be compiled with +clipboard for system clipboard support.
-   On macOS, + and \* registers behave the same.

### Undo and Redo

Undoing and redoing changes in Vim.

#### Accessibility

Undo and redo actions should confirm the state change.

#### Best Practices

-   Enable persistent undo with set undofile in your vimrc.
-   Use :earlier and :later for time-based undo when you need to go back further.
-   Remember that U counts as a change itself and can be undone with u.

#### Common Errors

-   **Cannot redo after branching undo:** Use g- and g+ to move through the undo tree branches, or :earlier/:later for time-based navigation.
-   **Undo history lost after closing file:** Add set undofile and set undodir=~/.vim/undodir to your vimrc. Create the directory first.

#### Keywords

undoredohistoryrevert

[Learn more](https://vimhelp.org/undo.txt.html#undo)

#### Basic undo and redo

Vim maintains an undo tree that allows undoing and redoing changes.

Code

```
1u       " Undo last change2Ctrl-R  " Redo last undone change3U       " Undo all changes on current line45u      " Undo last 5 changes
```

-   Vim has unlimited undo by default (limited only by memory).
-   U (uppercase) undoes all changes on the current line since last entering it.

#### Undo branches and persistence

Vim tracks undo as a tree, not just a linear stack. Use time-based undo to revert by duration.

Code

```
1:undolist       " Show undo branches2g-              " Go to older text state3g+              " Go to newer text state4:earlier 10m    " Go to state 10 minutes ago5:later 5m       " Go to state 5 minutes from undo point6:set undofile   " Enable persistent undo across sessions
```

-   :earlier and :later accept time units like s, m, h.
-   Enable undofile in your vimrc for persistent undo history.

### Find and Replace

Search and replace text using substitute commands.

#### Accessibility

Replacement confirmations should be clearly prompted.

#### Best Practices

-   Always use the c flag (:%s/old/new/gc) when making large replacements to verify each change.
-   Use visual selection to limit substitution scope.
-   Test the search pattern with / first before running substitution.

#### Common Errors

-   **Unintended replacements across the file:** Use line ranges (:5,10s/...) or visual selection to limit scope. Add the c flag for confirmation.
-   **Regex special characters causing errors:** Escape special regex characters (.\*\[\]^$) with backslash, or use \\V for literal matching.

#### Keywords

findreplacesubstituteregexsearchglobal

[Learn more](https://vimhelp.org/change.txt.html#:substitute)

#### Basic substitution

The substitute command is one of the most-used editing tools in Vim.

Code

```
1:s/old/new/          " Replace first 'old' on current line2:s/old/new/g         " Replace all 'old' on current line3:%s/old/new/g        " Replace all 'old' in entire file4:%s/old/new/gc       " Replace all with confirmation
```

-   The g flag means global (all occurrences on a line).
-   The c flag prompts for confirmation at each match.

#### Advanced substitution

Advanced substitution with ranges, flags, and regex word boundaries.

Code

```
1:5,20s/old/new/g     " Replace in lines 5 through 202:'<,'>s/old/new/g    " Replace in visual selection3:%s/old/new/gi       " Case-insensitive replace4:%s/\<word\>/new/g   " Replace whole word only5:%s/pattern//gn      " Count matches without replacing
```

-   Use \\< and \\> for word boundaries in Vim regex.
-   The n flag counts matches without performing replacement.

## Operators and Text Objects

Combining operators with motions and text objects for precise editing.

### Operators

Operators perform actions on text defined by a motion or text object.

#### Accessibility

Operator results should be clearly communicated.

#### Best Practices

-   Learn the operator + motion pattern: it makes all motions and text objects available to every operator.
-   Use . to repeat operator commands for efficient editing.
-   Combine operators with counts for batch operations (e.g., 3>> indents 3 lines).

#### Common Errors

-   **Operator affects more text than intended:** Use more precise motions or text objects. Undo with u and retry with the correct motion.
-   **Forgetting that operators wait for a motion:** After pressing an operator key (d, c, y), you must provide a motion or text object. Press Esc to cancel.

#### Keywords

operatordeletechangeyankindentcasefilter

[Learn more](https://vimhelp.org/motion.txt.html#operator)

#### Common operators with motions

The operator + motion pattern is the foundation of Vim editing: {operator}{motion}.

Code

```
1dw    " Delete from cursor to next word2d$    " Delete from cursor to end of line3cw    " Change word (delete and enter Insert mode)4c$    " Change from cursor to end of line5yip   " Yank inner paragraph6>>    " Indent current line right7<<    " Indent current line left8==    " Auto-indent current line
```

-   Double an operator to apply it to the whole line (dd, yy, cc, >>).
-   Operators can be prefixed with a count: 3dd deletes 3 lines.

#### Case and filter operators

Case operators change letter casing. The filter operator (!) pipes text through external commands.

Code

```
1gUw   " Uppercase from cursor to end of word2guw   " Lowercase from cursor to end of word3g~~   " Toggle case of entire line4g~w   " Toggle case of word5gUU   " Uppercase entire line6guu   " Lowercase entire line7!}sort " Filter paragraph through external sort command
```

-   g~ toggles case, gU uppercases, gu lowercases.
-   The ! operator pipes text through external tools.

### Text Objects

Text objects define regions of text for operators to act upon.

#### Accessibility

Text object boundaries should be clearly indicated.

#### Best Practices

-   Prefer text objects over motions for structural editing (ciw instead of bcw).
-   Use "inner" (i) when you want to preserve delimiters, "around" (a) to include them.
-   Combine text objects with . to repeat changes on similar structures.

#### Common Errors

-   **Text object not selecting expected range:** Make sure the cursor is inside the target structure. Text objects work from cursor position to the nearest enclosing pair.
-   **Using ci( when cursor is outside the parentheses:** Position cursor inside the parentheses first, or use a search motion to jump there.

#### Keywords

text objectinneraroundwordsentenceparagraphquotebrackettag

[Learn more](https://vimhelp.org/motion.txt.html#text-objects)

#### Word, sentence, and paragraph objects

i = inner (just the content), a = around (content plus surrounding whitespace/delimiters).

Code

```
1ciw   " Change inner word2caw   " Change a word (including surrounding space)3dis   " Delete inner sentence4dap   " Delete a paragraph (including trailing blank line)5yip   " Yank inner paragraph
```

-   ciw is one of the most commonly used text objects for replacing a word.
-   dap is useful for removing entire paragraphs cleanly.

#### Delimiter-based text objects

Delimiter text objects work with quotes, brackets, parentheses, and HTML/XML tags.

Code

```
1ci"   " Change inside double quotes2ca"   " Change around double quotes (including quotes)3di(   " Delete inside parentheses4da(   " Delete around parentheses (including parens)5ci{   " Change inside curly braces6dit   " Delete inside HTML/XML tags7cat   " Change around tags (including the tags)8ci[   " Change inside square brackets
```

-   These work regardless of cursor position within the delimiters.
-   Equivalent pairs: ci( = ci), ci{ = ci}, ci\[ = ci\].

### Repeating

Repeating commands and building efficient editing workflows.

#### Accessibility

Repeated actions should be clearly trackable.

#### Best Practices

-   Structure edits to maximize the usefulness of the dot command.
-   Use text objects (ciw, dap) for dot-repeatable changes.
-   Combine count prefix with motions and operators for batch operations.

#### Common Errors

-   **Dot command repeats unexpected action:** The dot command repeats the last change, not the last motion. Check what your last change was.
-   **Count not working with a command:** Not all commands support counts. Check the documentation for the specific command.

#### Keywords

repeatdotmacrocountsemicolon

[Learn more](https://vimhelp.org/repeat.txt.html#single-repeat)

#### Dot command and repetition

The dot command (.) repeats the last change.

Code

```
1.     " Repeat last change2;     " Repeat last f/F/t/T search3,     " Repeat last f/F/t/T in reverse43dd   " Delete 3 lines55j    " Move down 5 lines62yy   " Yank 2 lines74>>   " Indent 4 lines
```

-   Design your edits to be repeatable with dot (e.g., use ciw over individual character edits).
-   Number prefixes work with almost all commands.

#### Effective dot command usage

Combine search (n) with dot (.) for a manual find-and-replace workflow.

Code

```
1/word      " Search for 'word'2ciwreplace " Change word to 'replace'3n          " Jump to next occurrence4.          " Repeat the change5n          " Jump to next6.          " Repeat again
```

-   This pattern gives you control over each replacement, unlike :%s.
-   Use n to skip an occurrence, . to replace it.

## Visual Mode

Selecting and operating on text visually.

### Visual Selection

Entering Visual mode and selecting text.

#### Accessibility

Selection boundaries should be clearly highlighted and announced.

#### Best Practices

-   Use Visual mode for operations where you want to verify the selection before acting.
-   Prefer operator + text object (ciw) over visual select then operate (viwd) for repeated tasks.
-   Use gv to quickly reselect and modify a previous selection.

#### Common Errors

-   **Visual selection includes unexpected text:** Use o to toggle the active end of the selection and adjust boundaries.
-   **Exiting Visual mode accidentally:** Press gv to restore the previous selection.

#### Keywords

visualselectcharacterlineblockreselect

[Learn more](https://vimhelp.org/visual.txt.html#Visual)

#### Visual mode types

Visual mode provides a way to select text before applying an operator.

Code

```
1v      " Enter character-wise Visual mode2V      " Enter line-wise Visual mode3Ctrl-V " Enter block-wise Visual mode4gv     " Reselect last visual selection5o      " Move to other end of selection6O      " Move to other corner of block selection
```

-   Use o to adjust the other end of the selection without starting over.
-   gv reselects the same area after an operation.

#### Extending selections

Combine entering Visual mode with text objects or motions to select specific regions.

Code

```
1viw    " Select inner word2vip    " Select inner paragraph3vi"    " Select inside quotes4vi(    " Select inside parentheses5vit    " Select inside tags6V5j    " Select current line and 5 lines below
```

-   In Visual mode, any motion extends the selection.
-   Text objects in Visual mode select the entire object.

### Visual Operations

Operations you can perform on visually selected text.

#### Accessibility

Operation results should confirm what was changed.

#### Best Practices

-   Use Visual mode for one-off operations; use operators with motions for repeatable ones.
-   Use gq to reflow paragraphs after editing text.
-   Use visual + > repeatedly (with gv and .) for incremental indentation.

#### Common Errors

-   **Accidentally deleting instead of yanking:** Use u immediately to undo if you pressed d instead of y.
-   **Indent not applying to all selected lines:** Make sure you used V (line-wise) Visual mode for indentation operations.

#### Keywords

deleteyankchangeindentcasejoincommand

[Learn more](https://vimhelp.org/visual.txt.html#visual-operators)

#### Common visual operations

After making a visual selection, apply an operator to act on the selected text.

Code

```
1d    " Delete selection2x    " Delete selection (same as d)3y    " Yank (copy) selection4c    " Change selection (delete and enter Insert)5>    " Indent selection right6<    " Indent selection left7=    " Auto-indent selection8J    " Join selected lines
```

-   These operations exit Visual mode after execution.
-   Use gv to reselect if you need to apply another operation.

#### Case and formatting operations

Visual mode allows case changes, formatting, and running Ex commands on selected lines.

Code

```
1~    " Toggle case of selection2U    " Uppercase selection3u    " Lowercase selection4gq   " Format/rewrap selected text5:    " Enter command mode for selection (adds '<,'>)
```

-   Pressing : in Visual mode automatically adds the range '<,'>.
-   gq reformats text to the textwidth setting.

### Visual Block

Block-wise visual selection for column editing.

#### Accessibility

Block selection dimensions should be clearly described.

#### Best Practices

-   Use Ctrl-V + I for adding prefixes (like comment characters) to multiple lines.
-   Use Ctrl-V + A for appending suffixes to multiple lines.
-   Select with $ to include varying-length lines to their end.

#### Common Errors

-   **Block insert only appears on the first line:** You must press Esc to apply the change to all lines. Do not use Ctrl-C as it cancels.
-   **Block selection misaligned due to tabs:** Use :set expandtab or :retab to convert tabs to spaces for consistent column alignment.

#### Keywords

blockcolumnverticalmulti-lineinsertappend

[Learn more](https://vimhelp.org/visual.txt.html#blockwise-visual)

#### Block selection and editing

Block Visual mode enables column-oriented editing across multiple lines simultaneously.

Code

```
1Ctrl-V       " Enter block visual mode2I{text}Esc   " Insert text before block on all lines3A{text}Esc   " Append text after block on all lines4r{char}      " Replace all characters in block with {char}5c{text}Esc   " Change block content on all lines6d            " Delete the block
```

-   After pressing I or A, text appears on the first line only; it applies to all lines after pressing Esc.
-   Block mode suits editing tabular data or adding prefixes.

#### Practical block editing example

Practical examples of using block visual mode for commenting and uncommenting code.

Code

```
1" Add comment prefix to lines 5-15:25G          " Go to line 53Ctrl-V      " Enter block visual410j         " Extend selection 10 lines down5I# Esc      " Insert '# ' at start of each line6
7" Remove first 2 characters from lines:8Ctrl-V      " Enter block visual910j         " Select 10 lines10ll          " Extend 2 columns right11d           " Delete the block
```

-   This technique works well for adding/removing comment characters.
-   Use $ in block selection to extend to end of each line regardless of length.

## Windows and Tabs

Managing multiple views, windows, tabs, and buffers.

### Split Windows

Splitting the Vim window for side-by-side editing.

#### Accessibility

Window focus and layout changes should be announced.

#### Best Practices

-   Map Ctrl-h/j/k/l to Ctrl-W h/j/k/l in your vimrc for faster window navigation.
-   Use :vsp for comparing two files side by side.
-   Use Ctrl-W = after resizing to quickly equalize window dimensions.

#### Common Errors

-   **Window commands not recognized:** Make sure you are in Normal mode before pressing Ctrl-W. The Ctrl-W prefix only works in Normal mode.
-   **Accidentally closing the wrong window:** Use Ctrl-W q carefully. Check which window is active by looking at the cursor position.

#### Keywords

splitwindowhorizontalverticalresizenavigate

[Learn more](https://vimhelp.org/windows.txt.html#windows)

#### Creating and navigating splits

Splits let you view and edit multiple files or different parts of the same file.

Code

```
1:sp          " Horizontal split (same file)2:sp file     " Horizontal split with file3:vsp         " Vertical split (same file)4:vsp file    " Vertical split with file5Ctrl-W s     " Horizontal split (same as :sp)6Ctrl-W v     " Vertical split (same as :vsp)7Ctrl-W w     " Cycle through windows8Ctrl-W h     " Move to window left9Ctrl-W j     " Move to window below10Ctrl-W k     " Move to window above11Ctrl-W l     " Move to window right
```

-   Ctrl-W is the window command prefix for all window operations.
-   Use Ctrl-W w to cycle quickly between two windows.

#### Resizing and closing windows

Resize and manage window layout. Prefix resize commands with a count for larger adjustments.

Code

```
1Ctrl-W =     " Equalize window sizes2Ctrl-W _     " Maximize current window height3Ctrl-W |     " Maximize current window width4Ctrl-W +     " Increase height by 1 line5Ctrl-W -     " Decrease height by 1 line6Ctrl-W >     " Increase width by 1 column7Ctrl-W <     " Decrease width by 1 column8Ctrl-W q     " Close current window9:only        " Close all windows except current
```

-   Use 10 Ctrl-W + to increase height by 10 lines.
-   Ctrl-W = is useful after creating/closing splits to rebalance.

### Tab Pages

Using tab pages for organizing multiple files.

#### Accessibility

Active tab and tab list should be clearly communicated.

#### Best Practices

-   Use tabs for different tasks or contexts (e.g., one tab per feature).
-   Use buffers and splits within tabs for related files.
-   Map tab navigation to convenient keys in your vimrc (e.g., leader+n/p).

#### Common Errors

-   **Too many tabs open causing confusion:** Use :tabs to list all tabs. Consider using buffers (:ls, :bn) instead for many files.
-   **New tab opens empty instead of with a file:** Use :tabe filename instead of :tabnew to open a file directly in a new tab.

#### Keywords

tabtabpagetabnewtabclosenavigate

[Learn more](https://vimhelp.org/tabpage.txt.html#tabpage)

#### Creating and managing tabs

Tabs in Vim are layouts that can each contain multiple windows/splits.

Code

```
1:tabnew        " Open a new empty tab2:tabe file     " Open file in a new tab3:tabclose      " Close current tab4:tabonly       " Close all other tabs5:tabs          " List all tabs
```

-   Vim tabs are different from tabs in other editors. Each tab can contain multiple windows.
-   Use :tabe with a file path to quickly open files in new tabs.

#### Navigating between tabs

Navigate between tabs using Normal mode shortcuts or Ex commands.

Code

```
1gt           " Go to next tab2gT           " Go to previous tab33gt          " Go to tab 34:tabfirst    " Go to first tab5:tablast     " Go to last tab6:tabmove 0   " Move current tab to first position7:tabmove     " Move current tab to last position
```

-   gt and gT are the fastest way to switch tabs.
-   Tab numbers are 1-indexed in Vim.

### Buffers

Managing buffers for efficient multi-file editing.

#### Accessibility

Buffer status and active buffer should be announced.

#### Best Practices

-   Use :set hidden to switch buffers without saving first.
-   Prefer buffers over tabs for managing many files: :b with partial matching is very fast.
-   Use :bd to clean up buffers you no longer need.

#### Common Errors

-   **E37: No write since last change when switching buffers:** Either save with :w first, or add set hidden to your vimrc to allow unsaved buffer switching.
-   **Cannot find buffer by name:** Use :ls to see exact buffer names, then :b with a unique substring.

#### Keywords

bufferlistswitchdeletehidden

[Learn more](https://vimhelp.org/windows.txt.html#buffers)

#### Listing and switching buffers

Buffers represent open files in memory. You can switch between them without closing any.

Code

```
1:ls          " List all buffers2:buffers     " List all buffers (same as :ls)3:bn          " Go to next buffer4:bp          " Go to previous buffer5:b name      " Switch to buffer by partial name6:b 3         " Switch to buffer number 37:b#          " Switch to alternate (last used) buffer
```

-   :b with partial name matching allows quick buffer switching.
-   Ctrl-^ or :b# toggles between the current and last buffer.

#### Buffer management

Manage buffer lifecycle and apply commands across multiple buffers.

Code

```
1:bd          " Delete (close) current buffer2:bd 3        " Delete buffer number 33:bd file.txt " Delete buffer by name4:set hidden  " Allow switching buffers without saving5:%bd         " Delete all buffers6:bufdo cmd   " Execute command in all buffers
```

-   set hidden in your vimrc allows switching buffers with unsaved changes.
-   :bufdo runs one command across every buffer (e.g., :bufdo %s/old/new/ge).

## Advanced Features

Advanced Vim features for power users.

### Macros

Recording and replaying sequences of commands.

#### Accessibility

Macro recording status should be clearly indicated.

#### Best Practices

-   Structure macros to end at the start of the next target for easy repetition.
-   Use lowercase register to overwrite, uppercase (qA) to append to an existing macro.
-   Test macros on one line before applying to many.

#### Common Errors

-   **Macro stops partway through execution:** The macro likely encountered an error (e.g., search not found). Edit the macro register with :let @a='' and re-record.
-   **Macro recorded wrong keystrokes:** View the macro content with :reg a, then edit with :let @a = "new content".

#### Keywords

macrorecordreplayregisterautomate

[Learn more](https://vimhelp.org/repeat.txt.html#complex-repeat)

#### Recording and playing macros

Macros record a sequence of keystrokes and replay them. They are stored in registers (a-z).

Code

```
1qa       " Start recording macro into register 'a'2q        " Stop recording3@a       " Play macro stored in register 'a'4@@       " Replay the last executed macro55@a      " Play macro 'a' five times
```

-   The bottom of the screen shows 'recording @a' while recording.
-   Macros can include any Normal mode commands, motions, and operators.

#### Practical macro example

A practical macro that wraps each line in quotes and adds a trailing comma.

Code

```
1" Convert a list of words to quoted, comma-separated:2" apple       ->  'apple',3" banana      ->  'banana',4" cherry      ->  'cherry',5
6qa            " Start recording to register a7I'Esc         " Insert quote at start8A',Esc        " Append quote and comma at end9j0            " Move to start of next line10q             " Stop recording112@a           " Apply to next 2 lines
```

-   End macros with j0 to position for the next line, making them repeatable.
-   Use a large count (e.g., 999@a) to apply a macro to all remaining lines.

### Registers

Named storage areas for text, macros, and special values.

#### Accessibility

Register contents should be accessible for review.

#### Best Practices

-   Use "0p to paste the last yanked text when a delete has overwritten the default register.
-   Use "\_d to delete without affecting any registers.
-   Use :reg to inspect register contents when debugging macros or yanks.

#### Common Errors

-   **Pasting wrong content after a delete operation:** Use "0p to paste the last yanked text, or use named registers to store important text.
-   **System clipboard register not available:** Verify clipboard support with :echo has("clipboard"). Install a clipboard-enabled Vim build if needed.

#### Keywords

registernamedclipboardyankblack holesystem

[Learn more](https://vimhelp.org/change.txt.html#registers)

#### Using named registers

Named registers (a-z) let you store multiple pieces of text independently.

Code

```
1"ay      " Yank into register 'a'2"ap      " Paste from register 'a'3"Ay      " Append to register 'a' (uppercase)4:reg     " View all register contents5:reg a   " View contents of register 'a'
```

-   Uppercase register name (A-Z) appends to the register instead of overwriting.
-   Registers are shared between yank, delete, and macro operations.

#### Special registers

Special registers hold system clipboard, last search, last command, and other special values.

Code

```
1"0p      " Paste last yanked text (not deleted)2"+y      " Yank to system clipboard3"+p      " Paste from system clipboard4"_d      " Delete to black hole register (truly delete)5"/       " Last search pattern register6":       " Last command register7".       " Last inserted text register8"%       " Current filename register
```

-   "0 always holds the last yank, even after deleting (which goes to "1-"9).
-   "\_ is the black hole register: text deleted into it is truly gone.

### Folds

Folding and unfolding sections of code or text.

#### Accessibility

Fold state and hidden line counts should be announced.

#### Best Practices

-   Set foldmethod=indent or foldmethod=syntax in your vimrc for automatic code folding.
-   Use zM to collapse everything, then zo to open just the section you need.
-   Set foldlevel to control initial fold depth: set foldlevel=1.

#### Common Errors

-   **E350: Cannot create fold with current foldmethod:** Manual folds require foldmethod=manual. Use :set foldmethod=manual to enable.
-   **Folds not persisting between sessions:** Add set viewoptions+=folds and autocmds for mkview/loadview in your vimrc.

#### Keywords

foldunfoldtoggleopenclosecreate

[Learn more](https://vimhelp.org/fold.txt.html#folding)

#### Managing folds

Folds hide sections of text, making large files easier to navigate.

Code

```
1zo       " Open fold under cursor2zO       " Open fold under cursor recursively3zc       " Close fold under cursor4zC       " Close fold under cursor recursively5za       " Toggle fold under cursor6zA       " Toggle fold under cursor recursively7zM       " Close all folds in document8zR       " Open all folds in document
```

-   za is the most convenient for toggling individual folds.
-   zM and zR are useful for getting an overview or seeing all content.

#### Creating folds

Create folds manually or configure automatic folding by indent, syntax, or other methods.

Code

```
1zf{motion}    " Create a fold over motion2zf5j          " Create fold over next 5 lines3:3,10fold     " Create fold from line 3 to 104zd            " Delete fold under cursor5zE            " Delete all folds in window6:set foldmethod=indent  " Fold by indentation7:set foldmethod=syntax  " Fold by syntax8:set foldmethod=manual  " Manual fold creation
```

-   Manual folds require foldmethod=manual.
-   For code, foldmethod=syntax or foldmethod=indent are most useful.

### Spell Checking

Built-in spell checking in Vim.

#### Accessibility

Spelling errors should be highlighted and navigable.

#### Best Practices

-   Enable spell checking for prose files with autocommands in your vimrc.
-   Maintain a personal spell file for technical terminology.
-   Use :set spelllang=en\_us,en\_gb for multiple language support.

#### Common Errors

-   **Spell file not found:** Vim will offer to download it. Accept, or manually place spell files in ~/.vim/spell/.
-   **Too many false positives in code files:** Vim only checks spelling in comments and strings for syntax-highlighted files. Disable for code with :set nospell.

#### Keywords

spellspellcheckdictionarycorrectsuggest

[Learn more](https://vimhelp.org/spell.txt.html#spell)

#### Spell check commands

Vim has built-in spell checking that highlights misspelled words and offers corrections.

Code

```
1:set spell       " Enable spell checking2:set nospell     " Disable spell checking3:set spelllang=en_us " Set spell language4]s               " Jump to next misspelled word5[s               " Jump to previous misspelled word6z=               " Show spelling suggestions7zg               " Add word to spell file (good word)8zw               " Mark word as incorrect (wrong word)9zug              " Undo zg (remove from spell file)
```

-   Misspelled words are highlighted based on your colorscheme.
-   Use \]s and \[s to quickly navigate between spelling errors.

#### Spell checking workflow

A typical workflow for spell-checking a document using Vim.

Code

```
1:set spell        " Turn on spell check2]s                " Go to first error3z=                " See suggestions, pick number41z=               " Accept first suggestion directly5]s                " Go to next error6zg                " Add technical term to dictionary
```

-   1z= accepts the first suggestion without showing the menu.
-   Use zg liberally for technical terms and proper nouns.

### Command-Line Tricks

Ex commands and external command integration.

#### Accessibility

Command output should be displayed clearly.

#### Best Practices

-   Use :g/pattern/d to quickly clean up files (remove debug lines, empty lines, etc.).
-   Use :%norm for batch edits that are hard to express with substitution.
-   Combine :r with shell commands for inserting dynamic content.

#### Common Errors

-   **External command not found:** Make sure the command is in your PATH. Use full paths if needed (e.g., :!/usr/bin/python %).
-   **:norm command not doing what expected:** Remember that :norm executes from the start of the line. Use :norm! to ignore user mappings.

#### Keywords

commandexternalshellfilternormalexecute

[Learn more](https://vimhelp.org/various.txt.html#:!cmd)

#### External commands and filters

Vim integrates with the shell, letting you run commands and pipe text through filters.

Code

```
1:!ls              " Run external command2:!python %        " Run current file with Python3:r !date          " Insert output of date command4:r !curl -s URL   " Insert content from URL5:.!tr a-z A-Z     " Filter current line through tr6Ctrl-R Ctrl-W     " Insert word under cursor in command line
```

-   % in Ex commands refers to the current filename.
-   :r inserts command output below the cursor.

#### Normal and global commands

:norm runs Normal mode commands on lines. :g (global) runs commands on matching lines.

Code

```
1:norm A;          " Append semicolon to current line2:%norm A;         " Append semicolon to all lines3:g/pattern/d      " Delete all lines matching pattern4:v/pattern/d      " Delete all lines NOT matching pattern5:g/TODO/norm O    " Add blank line above every TODO6:.                " Repeat last Ex command
```

-   :g/pattern/command runs a command on every matching line.
-   :v is the inverse of :g, matching lines that do NOT contain the pattern.

### Options and Settings

Common Vim options for customizing your editing environment.

#### Accessibility

Setting changes should be confirmed when applied.

#### Best Practices

-   Put your preferred settings in ~/.vimrc for persistence.
-   Use both number and relativenumber together for hybrid line numbers.
-   Set expandtab with consistent tabstop/shiftwidth for portable indentation.

#### Common Errors

-   **Settings reset after restarting Vim:** Add settings to your ~/.vimrc file for persistence. Use :mkvimrc to generate one from current settings.
-   **Mixed tabs and spaces in file:** Set expandtab and run :retab to convert all tabs to spaces uniformly.

#### Keywords

setoptionsettingnumbersearchtabindent

[Learn more](https://vimhelp.org/options.txt.html#options)

#### Display and search settings

Configure how Vim displays content and handles searching.

Code

```
1:set number          " Show line numbers2:set relativenumber  " Show relative line numbers3:set cursorline      " Highlight current line4:set hlsearch        " Highlight search matches5:set incsearch       " Show matches while typing6:set ignorecase      " Case-insensitive search7:set smartcase       " Case-sensitive if uppercase present8:set nowrap          " Disable line wrapping
```

-   Combine ignorecase with smartcase so a capital letter in the pattern makes the search case-sensitive.
-   Toggle any boolean option with :set option! (e.g., :set number!).

#### Indentation and tab settings

Configure how Vim handles indentation, tabs, and whitespace display.

Code

```
1:set expandtab       " Use spaces instead of tabs2:set tabstop=4       " Display width of tab character3:set shiftwidth=4    " Number of spaces for auto-indent4:set softtabstop=4   " Spaces per Tab keypress5:set autoindent      " Copy indent from current line6:set smartindent     " Smart auto-indenting for C-like code7:set list            " Show invisible characters8:set listchars=tab:>-,trail:. " Define how to show invisibles
```

-   Always set all four tab-related options together for consistency.
-   Use :retab to convert existing tabs to spaces (or vice versa).

### Redirection and Pipes

Piping text to and from external commands.

#### Accessibility

Pipe operation results should be clearly displayed.

#### Best Practices

-   Use :%!sort for quick sorting without leaving Vim.
-   Use Unix tools through pipes for complex text transformations.
-   Test filter commands on a small selection before applying to the whole file.

#### Common Errors

-   **Buffer replaced with error output from command:** Use u to undo immediately. Test the command with :!cmd first before piping with :%!cmd.
-   **:w !cmd confused with :w!cmd:** :w !cmd pipes to a command. :w!cmd force-writes to a file named cmd. The space matters.

#### Keywords

piperedirectfiltersortshellwriteread

[Learn more](https://vimhelp.org/editing.txt.html#:write_c)

#### Filtering and piping

Vim can pipe buffer content to shell commands and read results back.

Code

```
1:w !cmd          " Pipe buffer content to external command2:r !cmd          " Read command output into buffer3:%!sort          " Sort all lines in the file4:%!sort -u       " Sort and remove duplicates5:'<,'>!sort      " Sort selected lines6:%!python -m json.tool " Format JSON
```

-   :w !cmd writes to stdin of cmd, not to a file named !cmd.
-   :%!cmd replaces the entire buffer with the command output.

#### Clipboard and advanced piping

Use external tools for clipboard operations and advanced text processing.

Code

```
1:w !pbcopy          " Copy buffer to macOS clipboard2:r !pbpaste         " Paste from macOS clipboard3:w !xclip -sel clip " Copy to clipboard on Linux4:w !wl-copy         " Copy to clipboard on Wayland5:%!column -t        " Align text into columns6:%!awk '{print $2}' " Extract second field of every line
```

-   Choose the clipboard command based on your operating system.
-   Combine with visual selection for operating on specific regions.

Was this useful?

## Tags

#Editor#Vim#Text Editor#Terminal#Productivity#Keyboard Shortcuts

## Share

[Facebook](https://facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim "Share on Facebook")[Twitter](https://twitter.com/intent/tweet/?text=Vim&url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim "Share on Twitter")[LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim&title=Vim&summary=Vim%20is%20a%20highly%20configurable%20text%20editor%20built%20to%20make%20creating%20and%20changing%20any%20kind%20of%20text%20very%20efficient.%20It%20is%20included%20as%20%22vi%22%20with%20most%20UNIX%20systems.&source=https://mkabumattar.com "Share on LinkedIn")[WhatsApp](https://wa.me/?text=Vim%20https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim "Share on WhatsApp")[Telegram](https://t.me/share/url?url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim&text=Vim "Share on Telegram")[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim&title=Vim "Share on Reddit")[Hacker News](http://news.ycombinator.com/submitlink?u=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim&t=Vim "Share on Hacker News")[Pinterest](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim&media=&description=Vim%20is%20a%20highly%20configurable%20text%20editor%20built%20to%20make%20creating%20and%20changing%20any%20kind%20of%20text%20very%20efficient.%20It%20is%20included%20as%20%22vi%22%20with%20most%20UNIX%20systems. "Share on Pinterest")[Email](<mailto:?subject=Vim&body=Check out this article: https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fvim>)

## Comments

## You might also enjoy

More posts on similar topics

## [VS Code](/cheatsheets/vscode)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Editor
-   Text Editor
-   Developer Tools
-   Productivity
-   Programming
-   Shortcuts

A quick reference for Visual Studio Code: keyboard shortcuts, editor features, and working habits for editing and navigation.

#VS Code#Visual Studio Code#Keyboard Shortcuts+3 tags

[read more](/cheatsheets/vscode)

## [Screen](/cheatsheets/screen)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Terminal
-   Screen
-   Tools
-   Development
-   System Administration

Getting started GNU Screen is a terminal multiplexer that gives you:Sessions: Full terminal environments that persist even if you disconnect Windows: Multiple terminals (tabs) within

#Screen#Terminal Multiplexer#Sessions+2 tags

[read more](/cheatsheets/screen)

## [Tmux](/cheatsheets/tmux)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Terminal
-   Tmux
-   Tools
-   Development
-   System Administration

Tmux is a terminal multiplexer for managing multiple terminal sessions, windows, and panes within a single screen. This cheatsheet covers the commands, keybindings, and configuration options for every

#Tmux#Terminal Multiplexer#Sessions+3 tags

[read more](/cheatsheets/tmux)

## [Git](/cheatsheets/git)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Version Control
-   Git
-   SCM
-   Collaboration
-   Development Tools

Git is a distributed version control system. Developers use it to track code changes, collaborate with teams, and manage project history. Most software teams build their workflow around it. Key co

#Git#Version Control#Branches+5 tags

[read more](/cheatsheets/git)

## [Python Virtual Environments Cheatsheet](/cheatsheets/python-venv)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Python
-   Development Tools
-   Dependency Management

A fast reference for keeping Python projects isolated and reproducible. It covers creating and activating environments with venv, installing packages with pip, locking dependencies with requirements f

#Python#Virtualenv#Pip+5 tags

[read more](/cheatsheets/python-venv)

## [AWK](/cheatsheets/awk)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Terminal
-   Text Processing
-   Linux
-   Command Line
-   Development Tools
-   Scripting

AWK complete reference guide Quick start Print entire file awk '{ print }' file.txt# Print specific column awk '{ print $1 }' file.txt# Print lines matching pattern awk '/patter

#AWK#Text Processing#Pattern Matching+3 tags

[read more](/cheatsheets/awk)

6 related posts
