VIM Editor

A widely used Linux Editor

VIM Editor

VIM is a widely used file editor of Linux. Here you can get to know the usage and functionality of the VIM editor.

Syntax: vim filename/filepath

  • There are three modes in VIM.
    • Command Mode
    • Insert Mode
    • Executable Mode

By default, you are in command mode. Where you can do multiple operations as per the requirements like a copy, cut, paste the data and etc...

Below are mentioned commands, you can use for the operation in command mode:

  • yy : Use to copy a line.
  • nyy : Use to copy the lines from a cursor(n= number).
  • p : Use to paste copied lines below.
  • P : Use to paste copied lines above.
  • dd : Use to cut a line
  • ndd : Use to cut the lines from a cursor(n=number).
  • u : Use for doing undo the changes.
  • set number (:se nu) : To see the line numbers in file.
  • set nonumber : To remove the line number in file.
  • / : Can use for search in a file.

In Insert Mode, We can edit the files.

  • We can use "i" to go into the insert mode. And also we can use "o" to go into the insert mode. When we will use the "o" at the time cursor will go one line below.

In Executable Mode, We will exit the file. Below are the commands to exit the file with different scenarios:

  • q : to quit the file without changing anything.
  • q! : to quit forcefully without saving.
  • w : to save the content in the file.
  • wq : to save the content and exit the file.

Folks, you can use this blog to learn about the VIM editor. and if you have any doubts then please let me know. I will happy to help you.

Thank you for your time and for reading my blog.