Skip to main content

Raymii.org Raymii.org Logo

Quis custodiet ipsos custodes?
Home | About | All pages | Cluster Status | RSS Feed

Vim Cheatsheet

Published: 01-01-2007 | Author: Remy van Elst | Text only version of this article


❗ This post is over seventeen years old. It may no longer be up to date. Opinions may have changed.

Table of Contents


Note: Not finished yet!

Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:

I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!

Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.

You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.

Splits

:sp - split horizontal
:vsp - split vertical
^W + l - move left
^W + k - move split up
^W + j - move split down
^W + h - move split left

Navigation

gg - go to beginning of a file
G - go to the end of the file
3G - go to the 3rd line
w - go to beginning of next word
e - go to end of word
b - go to beginning of word.
3w - go to the 3rd word.
% - go to matching parentheses
^/0 - go to beginning of line
$ - go to end of line

Typing

o - insert new line below current one
O - insert new line above current one
A - start typing at the end of this line.

Finding

  • - find next occurence of word under the cursor
    # - find previous occurence of word under the cursor.
    :s/foo/bar/g - replace foo with bar on this line.
    :%s/foo/bar/g - replace all foo's with bar's
    /foo - find 'foo'.
    n/N - go to next match/go to previous match.
Tags: cheatsheet , editor , snippets , vi , vim