q VIM Command

How to use q Command in Linux VIM editor?

Explanation


q stands for quit
This Command is used to exit from the vim editor. If any changes are done in the file, then the editor prompts option to save the changes or not.

Usage:

:q

Example:

  • Open the file test.txt using the command
    $ vim test.txt
  • To make the editor into insert mode
    Press i
  • Enter the test 'Hscripts'
  • To come out of insert mode
    Press Esc
  • To quit the file
    Press :q
  • This will prompt the command like follows
    q Vim Command
  • To quit without saving
    Press :q!
    ! is used in command to force any operation.
    so q! will force the editor to exit or quit without saving the changes.
    Quit / Exit from Linux Vim

Ask Questions

Ask Question