Vim is an editor with a very large operation set which expands even further when plugins are factored in. Due to this vastness it is easy to forget some useful commands and capabilities.
This post is mainly intended to remind myself of some of these capabilities since my brain can house only so much Vim knowledge.
Open the URL under the cursor in a browser.
Delete the character immediately to the left of the cursor.
Carry out a one time normal mode command. The
zz-centering command is useful
in this situation.
Insert from the named register. The
0 yank register is a useful register to
Insert a mathematical value, for example
48343 + 1684.
Repeat the last visual selection.
Change current visual selection to inversed or forced-lower or forced-upper case.
~ u U
Visually select current inner or around paragraph.
Visually select current inner or around sentence.
Visually select current inner or around tag.
Sort visual selection.
Unique the visual selection.
new in a rectangular visual block.
Undo to an earlier time, for example
10m (50 seconds or 10 minutes).
Redo to a later time, for example
Read in command line generated output.
For example, append all
txt filenames from the current directory.
:r !ls *.txt
Delete all lines containing
Delete all lines not containing
Cursor Positioning and Movement
Move the current cursor line to the top of the screen.
Move the current cursor line to the center of the screen.
Move the current cursor line to the bottom of the screen.
Scroll horizontally half a screen to the right.
Move the cursor to the top line of screen (High).
Move the cursor to the middle line of screen (Mid).
Move the cursor the bottom line of screen (Low).
Set a mark in the current file.
Return back to the
m mark in the current file.
Set a global mark in any file.
Return back to the global
Move forward and backward between paragraphs.
Move forward and backward between sentences.
Move to the end of the previous word or WORD.
Scroll window up one line.
Scroll window down one line.
Navigate to definition under cursor, often by using tags.
Navigate back to the previous location (out).
Navigate forwards (in). This is the opposite of
Suggest a spelling correction.
Add word under cursor to your local spell file.
Move to next spelling error.
Move to the previous spelling error.
Files To Edit
txt files in the current directory hierarchy.
% vim **/*.txt
If using Bash please enable
globstar in your
~/.bashrc file via the
shopt -s globstar statement.
Edit all files that the ripgrep
utility recursively finds contains the term
% vim $(rg -l FOO)
Usage hint for the vim-grepper plugin.
Restrict a ripgrep based search to a particular filetype.
:GrepperRg -t<type> <pattern>
Insert mode usage hints for the vim-ragtag plugin.
Close the previous open tag.
Convert the current word into open and close tags.
Same as previous except split over multiple lines.
Usage hints for the vim-unimpaired plugin.
Navigate backward and forward through the buffer list.
Navigate up and down through the quickfix list.
Navigate up and down through the location list.
Navigate backward and forward through the file list.
Add a blank line above or below the current line.
Move the current line, or visual lines, up dow down.
Paste above or below the current line.
Paste above or below the current line and increase the indent.
Paste above or below the current line and re-indent.
Toggle search highlights.
Toggle relative line numbers.
Toggle line wrapping.
Toggle cursor cross-hairs.
Usage hints for the vim-fugitive plugin.
Stage or unstage a file in
Toggle inline diff in
Display a vdiff on the current file in
Commit the current staged files in
Usage hints for the vim-ruby plugin.
Navigate up and down to the start of method definitions.
Navigate up and down to the end of method definitions.