Friday, June 19, 2020

vim editor command in linux

VIM  Editor

Vim is a clone, with additions, of Bill Joy's vi text editor program for Unix. Vim's author, Bram Moolenaar, based it on the source code for a port of the Stevie editor to the Amiga and released a version to the public in 1991.
Unix    - VI
Linux  -  VI Improved

There Are Three Mode In VI Editor.

  • Command Mode - Read, Copy, Paste, Delete, Move, Switch Numbering, Cut.
  • Insert Mode         - This Mode Help To Write Text And Contain.
  • Esc Mode            -  Also known As Extended Command Mode,Out From The Editor.

Setp 1) Install Vim: 

  • On Ubuntu: sudo apt update && sudo apt install vim
  • On CentOS: sudo yum update && sudo yum install vim


Step 2) Vim Editor Useful Command:

Basic Command:


  • vim file_name  - to enter into file
  • i                        - inter into insert mode
  • :q                      - quit without saving the file
  • :q!                     - qit forcefully without saving
  • :w                     - save the contain
  • :wq                   - save and quit
  • :wq!                  - save and quit forcefully

    Advance Command:

  • :se nu                 - set line number
  • :se nonu             - remove the line number
  • :20                     - jump into line number 20 in the file
  • shift + g             - jump into bottom of the file
  • gg                      - jump into top of the file
  • 5yy                    - copy 5 line
  • p                        - paste 
  • 5dd                    - delete 5 line
  • 3cc                     - cut the 3 line
  • u                        - undo
  • ctrl+r                 - redo

Nano Editor

Nano is a simple, user-friendly, and lightweight text editor for the command line.
editor comes with Linux default installation.

Saving changes:
  • Ctrl + O: Save the file.
  • Press Enter to confirm the file name.

Exiting Nano:
  • Ctrl + X: Exit Nano.
  • If changes are unsaved, Nano will prompt you to save them.

Undo/Redo:
  • Alt + U: Undo the last action.
  • Alt + E: Redo the last undone action.

No comments:

Post a Comment

testing