Select All Text in Vim

There is no built-in keyboard shortcut to select all text in Vim. Here's what you can do in that case.
Warp Terminal

Want to select everything in Vim? Just follow 3 simple steps:

  1. Press the Esc key to switch to normal mode
  2. Press gg to jump to the beginning of the file
  3. Press V or Ctrl + v to enable visual mode
  4. Finally, press Ctrl + End to get to the end of the file

If I were to conclude it, first press ggV and then Ctrl + End and it will select everything in Vim.

Want to know everything in detail? I got you.

Step 1: Switch to normal mode (press the Esc key )

Normal mode which is also known as command mode is necessary to select everything in Vim.

So if you were in insert or any other mode, press the Esc key to switch to the normal mode. Even if you don't know what mods are, you can still press the Esc key, it won't harm your system.

Step 2: Go to the beginning of the file (press gg)

To select everything in the file, it is necessary to select everything and for that, you have to start the selection from the beginning.

For that, you can either use gg (press the g key twice) or [[ and it will get you to the beginning of the file:

Jump to the beginning of the file in Vim

Step 3: Enable visual mode (press V)

Visual mode provides better visibility to select text in Vim which can be enabled by pressing the V or Ctrl + v.

Once pressed, it will notify that Visual mode is enabled by saying Visual Line:

Enable visual mode in Vim

Step 4: Go to the end of the file (press Ctrl + End)

This is the final step where all you have to do is press Ctrl + End to get to the end of the file in Vim and it will select everything from beginning to end:

select all in Vim editor

That's it!

Here are some helpful Vim tips and tricks

If know the basic commands of Vim and now want to learn some tips and tricks, here are tips and tricks to make you a pro-Vim user:

11 Pro Vim Tips to Get Better Editing Experience
You can learn plenty of Vim tips on your own, or you can learn it from others’ experiences.

If you want to take your Vim skills to the next level, this is for you.

Mastering Vim Quickly

Master Vim like a true professional with this highly rated, premium Vim book and training course.

Chek it out

I hope you will find this guide helpful.

About the author
Sagar Sharma

Sagar Sharma

A software engineer who loves to write about his experience with Linux. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.

It's FOSS

Making You a Better Linux User

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.