How to Use Vim Like a Real Pro

Vim is a text editor. It runs in your terminal. You use it to write or edit text files. It’s fast, lightweight, and powerful. But at first, it feels like learning to ride a unicycle. Blindfolded.

I remember the first time I opened Vim. I couldn’t even quit. I pressed every key I could think of. Nothing worked. I had to close the terminal window. You might be here because you had a similar moment. Don’t worry—you’re not alone.

Once you learn Vim’s basic moves, it becomes second nature. It’s like playing an instrument. A strange, keyboard-based instrument.

This guide will help you start using Vim the smart way, with tricks that make you look like a pro (or at least feel like one).


What Is Vim, Really?

Vim stands for “Vi IMproved.” It’s a better version of an older editor called Vi. Vim runs in a terminal window. You use it without a mouse. That sounds scary, but it actually makes editing faster.

Instead of clicking, you press keys to move, copy, paste, and more.

A few important terms:

  • Buffer: The file you are editing.
  • Command mode: The mode where you give instructions (like saving or deleting).
  • Insert mode: The mode where you type text.

To switch from Insert mode to Command mode, press Esc.
To go from Command mode to Insert mode, press i.

Now, let’s go step by step.


Step 1: Open a File

In your terminal, type:

vim filename.txt

This opens the file filename.txt. If it doesn’t exist, Vim creates it. But you can’t just start typing. You’re in Command mode.


Step 2: Enter Insert Mode

To type text, press i. You’re now in Insert mode. Type as you would in any text editor.

Want to return to Command mode? Press Esc.


Step 3: Save and Quit

This confused me a lot at first. Here’s how to save and quit:

  • :w — write (save)
  • :q — quit
  • :wq — save and quit
  • :q! — quit without saving (great for when you mess up)

Press Esc to make sure you’re in Command mode first.


Move Around Like a Ninja

Vim doesn’t use arrow keys (though they do work). It uses h, j, k, and l:

  • h — move left
  • j — move down
  • k — move up
  • l — move right

Sounds odd? It did to me too. But once you get used to it, your hands never leave the keyboard.

Want to move faster?

  • w — jump to next word
  • b — jump back a word
  • 0 — go to start of line
  • $ — go to end of line

It’s like teleporting instead of walking.


Edit Like a Pro

Here are some ways to change text:

  • x — delete one character
  • dd — delete the current line
  • dw — delete the next word
  • u — undo
  • Ctrl + r — redo

To copy and paste:

  • yy — yank (copy) a line
  • p — paste after cursor
  • P — paste before cursor

Here’s a joke: Why did the developer go broke? Because he kept doing :q! and never saved his work.


Search and Replace

Searching in Vim is simple. Press / followed by the word you want to find:

/foo

Then press n to go to the next match, and N to go back.

To replace words:

:%s/old/new/g

This changes every “old” to “new” in the file.

  • % means the whole file
  • s stands for substitute
  • g means global (replace all matches, not just the first)

Careful with this one. It’s powerful. Kind of like giving a dog the TV remote.


Three Handy Lists

1. Basic Commands to Remember:

  • i — insert text
  • Esc — return to command mode
  • :w — save file
  • :q — quit Vim
  • :wq — save and quit

2. Quick Navigation Keys:

  • h — left
  • l — right
  • j — down
  • k — up
  • gg — go to top of file
  • G — go to bottom

3. Edit and Copy Tools:

  • dd — delete line
  • yy — copy line
  • p — paste after
  • u — undo
  • Ctrl + r — redo

Some Funny Truths About Vim

  • No one quits Vim the first time without Googling it.
  • Vim users talk about it like it’s a lifestyle.
  • Using Vim feels like flying a spaceship with your pinky.

But once you get it, you’ll wonder how you lived without it.


Practice Makes Comfortable

The more you use Vim, the easier it gets. Start with small tasks. Open a file. Type a note. Save it. Try deleting a word. Undo it. Redo it.

You don’t need to be perfect. Just keep using it.

I once replaced an entire config file by mistake using a bad substitute command. I had to restore from backup. But I learned from it.

You will too.


Final Thoughts

Using Vim like a pro doesn’t mean knowing everything. It means knowing enough to be fast and effective.

It’s okay to look up commands. It’s okay to make mistakes. Even long-time users forget stuff sometimes.

If you stick with it, Vim will become one of your favorite tools. It’s fast, powerful, and always ready to go.

Now, go open a file, press i, and start typing. Just don’t forget how to quit.

Leave a Reply