Feb 1, 2023 3 min read

Introduction to Vim

Introduction to Vim
Table of Contents

Vim is a commonly used text editor. I use it everyday to work with programs, scripts, and especially, configuration files. The following video gives a very basic introduction to Vim. Read on for more information about Vim.

Why Vim and not another editor like nano?

Well, nano is a great editor and it is installed on many distributions of Linux by default. However, you will find that Vim is extremely configurable. If you want an editor that you can customize to do exactly what you want, Vim could be it. Just be ready to spend some time learning exactly how to customize it!

How to Install Vim

If it's not already loaded on your system, you can install Vim from source (link below) or from package manager:

  • Debian/Ubuntu: apt install vim
  • Fedora/RHEL/CentOS: dnf install vim
  • SuSE: zypper install vim
  • Arch: pacman -S vim
  • macOS: brew install vim (Homebrew required)
  • Windows: choco install vim (Chocolatey required)


  • While in Vim, type :help for the online help system.
  • While in the terminal, type vimtutor for the lesson-based learning tool.

How to start a new file with Vim:

Simple type vim and that will open the editor and you can start typing. (See below for instructions on how to save the new file.)

How to open an existing file in Vim

  • Example: vim newfile.txt
    This will open that file if it already exists. Or, it will create a new file named "newfile.txt" if it doesn't exist yet.

Vim Modes

  • Command Mode: The default mode. Designed to type commands in the bottom left corner. These commands can modify how the program works and how the file is displayed, among other things.
  • Insert Mode: This is where you type your content. Press i to get into insert mode.
  • Visual Mode: Change how things are oriented, how they look, cut/copy & paste, etc... Press v to get into visual mode.

If you are in insert or visual modes and you want to go back to command mode, simply press the Esc key.

Exiting Vim and Saving Files

:q is used to exit. :w is used to write (or save) the file. :wq writes and quits.
When you are done typing in a file, press Esc to go back to command mode. Then select one of the following:

  • Exit Vim without saving: :q
  • Write (save) the file without exiting: :w <filename>
  • Write an already existing file: :w
  • Exit Vim and write a new file: :wq <filename>
  • Exit Vim and write an existing file: :wq

Note: You can also use keyboard shortcuts. To exit, press Shift + ZQ. To save, press Shift + Z + Z.
Note: If you need it, there are plenty of good Vim cheat sheets on the Internet.

There is so much more to Vim!

We have only shown the tip of the iceberg so to speak. There is seemlingly endless configuration options for Vim. For example, to add line numbers to your code enter: :set number. To turn that off: :set nonumber. That's just one example of a million!

Also, you can make your settings permanent if you modify the .vimrc file, which is normally stored in the user's home directory.

Really, it just goes on and on. Watch out for the Vim rabbit hole!

And also... Neovim!

Yes, there are several forks of Vim. One popular one is Neovim, (run as nvim). Some people consider it to be more extensible and usable than Vim. That debate I leave to you.

There are many text editors and IDEs to choose from. Consider Vim for your workflow - it might be exactly what you want. Thanks for reading!
Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Prowse Tech.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.