Vim Cheat Sheet for Linux & Web Devs

Vim is not friendly, at least for me as an average Linux user, but Vim is more than just a text editor, it’s a productivity superpower for anyone working in a Linux environment or building web projects. Whether you’re tweaking a Nginx config file or editing HTML, mastering these “muscle memory” commands will save you hours (IF CAN).

In this guide, I’ve distilled the most essential Vim commands into a beginner-friendly format designed for daily use, for my daily use actually and hopefully help you too.

If you need more command available, then you can try to find here.

1. The “Essential Five” (Getting Started)

Before you dive into complex editing, you need to know how to navigate the modes and exit safely.

Command Action
i Insert Mode: Start typing text
Esc Normal Mode: Return here to use commands
:w Save: Write changes to disk
:wq Save & Exit: The standard way to close a file
:q! Force Quit: Exit without saving changes

2. Fast Navigation (Stop Using Arrow Keys)

Linux power users stay on the “home row.” Use these to fly through your scripts and logs.

  • h / j / k / l: Move Left, Down, Up, Right.
  • gg / G: Jump to the top / bottom of the file.
  • w / b: Jump forward/backward by word.
  • 0 / $: Jump to the start / end of a line.
  • %: Jump between matching brackets () or tags <div>.

3. Web Dev Magic: Editing HTML & Code

If you are editing HTML or CSS, these shortcuts are game-changers for attribute and tag management.

  • cit: Change Inside Tag – Instantly clears everything inside a tag and starts Insert mode.
  • ci”: Change Inside Quotes – Perfect for updating classes or href links.
  • >> / <<: Quickly Indent or Outdent a block of code.
  • o / O: Open a new line below / above the current one.

4. Copy, Paste & The “Magic Dot”

  • yy: Copy (Yank) the current line.
  • dd: Delete (Cut) the current line.
  • p: Paste after your cursor.
  • u / Ctrl + r: Undo / Redo.
  • . (Dot): Repeat the last edit. The most powerful key in Vim!

5. Pro Tip: Level Up Your ~/.vimrc

Add these to your config file to make Vim feel modern, you can create it if the file is not available, or still as a blank config, the file is on your HOME directory.

set number           " Show line numbers
syntax on            " Enable color coding
set mouse=a          " Enable mouse support
set clipboard=unnamedplus " Sync with system copy/paste

This Vim cheat sheet will help Me on working with the files, you might also want to use it when needed. Happy Vim days…..