• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / How To Use Vim Editor

How To Use Vim Editor

By Sourabh / December 18, 2019 Category: How To, Ubuntu

Learn how to use vim editor; how to open vim editor in Ubuntu. This post explains about the basic vim editor commands in Linux Ubuntu. Vim is an editor to create or edit a text file. Vim exists as a console application, and therefore use the command “vim” (without quotes) to launch Vim in a terminal emulator.

Modes in Vim

There are two modes in vim. One is the command mode and another is the insert mode. In the command mode, user can move around the file, delete text, etc. In the insert mode, user can insert text.

Changing Vim Mode

From command mode to insert mode type a/A/i/I/o/O

  • a Append text following current cursor position
  • A Append text to the end of current line
  • i Insert text before the current cursor position
  • I Insert text at the beginning of the cursor line
  • o Open up a new line following the current line and add text there
  • O Open up a new line in front of the current line and add text there

From insert mode to command mode type Esc (escape key)

Pressing the Esc key switches back to command mode. If you’re not sure what mode you’re in because you use a really old version of vi that doesn’t display an “INSERT” message, type Esc and you’ll be sure to return to command mode. It is possible that the system gives a little alert when you are already in command mode when hitting Esc, by beeping or giving a visual bell (a flash on the screen). This is normal behavior.

Please note that the following commands can be used with the vim to enable other modes and working console interface:

  • vim The “normal” way, everything is default.
  • ex Start in Ex mode.  Go to Normal mode with the “:vi” command. Can also be done with the “-e” argument.
  • view Start in read-only mode. You will be protected from  writing the files. Can also be done with the “-R” argument.
  • gvim gview The GUI version. Starts a new window. Can also be done with the “-g” argument.
  • evim eview The GUI version in easy mode. Starts a new window. Can also be done with the “-y” argument.

Working on Files

  • vi filename Creates a new file if it already does not exist, otherwise opens an existing file.
  • vi -R filename Opens an existing file in the read-only mode.
  • view filename Opens an existing file in the read-only mode.

Opening a New File

  • Type vim filename
  • Type i
  • Enter text
  • Hit Esc key
  • Type :wq

Editing a File

  • Type vim filename
  • Move around the file using h/j/k/l key or any appropriate command
  • Edit required text
  • Hit Esc key (exit from insert mode if you insert or replace text)
  • Type :wq

Moving through the text

Moving through the text is usually possible with the arrow keys. If not, try:

  • h to move the cursor to the left
  • l to move it to the right
  • k to move up
  • j to move down

Save and Exit

To save and quit the vi or vim editor with saving all the changes:

  • press Esc key if you are currently in insert or append mode .
  • Press : (colon). The cursor should reappear at the lower left corner of the screen beside a colon prompt.
  • Enter the following: q!

To learn the basics of vim editing, issue the following command in a terminal emulator:

vimtutor

Tags: Best Vim Book, Best Vim Tutorial, E: Unable To Locate Package Vim, How To Install Vim Mac, How To Install Vim Windows, How To Open Vim Editor In Ubuntu, How To Use Vim Cleaner, How To Use Vim Editor, How To Use Vim Mac, Install Gvim Ubuntu, Install Vim Apt-Get, Learning The Vi And Vim Editors, Online Vim Editor, Package 'Vim' Has No Installation Candidate, Practical Vim Pdf Download, Sudo Apt-Get Install Vim, Ubuntu Vim Commands, Vi Improved Vim, Vim Book Pdf, Vim Built In Tutorial, Vim Editor Commands, Vim Editor Commands In Linux, Vim Editor Commands In Linux Pdf, Vim Editor Tutorial, Vim Shortcuts Cheat Sheet Pdf, Vim Tutorial Command, Vim Tutorial For Beginners, Vim Tutorial Game, Vim Tutorial Pdf, Vim User Manual Pdf

Primary Sidebar

Latest Posts

Ubuntu 25.04 ‘Plucky Puffin’ Is Available To Download

How to Login as Root User in Linux Terminal

Install Firefox In Ubuntu Terminal Command Line

How To Check Kernel Installed Date In Linux Ubuntu

How To List All Kernel Modules That Are Loaded In Ubuntu

Enable Ubuntu Auto Login Without Password

Download Ubuntu 25.04 Official Default Wallpapers

How To Fix Initramfs Error In Ubuntu Command Line

How To Check All Available Kernel Version In Linux Ubuntu

3 Best Artificial Intelligence Domain Name Generators

© 2025 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap