02 - vim tutorial - vim mode like vim command mode vi edit mode vi visual mode| #linuxtopic

Linuxtopic
0
working with vi editor modes,vi command mode,vi insert mode,vi visual mode,vim command mode, vim visual mode, vi tutorial, vi command
Vim Editor insert mode, Command mode and Visual mode

vi or vim mode:

Vim support multiple mode, there are below three mode like

  •  Command mode 
  •  Command line mode
  •  Insert mode
  •  Visual mode

To help 

:help mode


 1 -  command mode

This is a default mode of vi editor and any files will be open by default in command mode

vi /tmp/linuxtopic.txt

In the bottom we can see the file name, written line number ( 7L ) and word character  ( 75C )

Follow Video Tutorial  for better understating :



2 - Command Line mode :

We can run command in command line mode, command line mode will start with colon ( : ) for example we want to save and exit the vi editor so we need to press Esc for command mode then press colon ( : ) key and type w for save and q for quit


3 - Insert mode

In insert mode we can edit our file, we can switch from default mode to insert mode by pressing "INC" key Or press " i " key from the  keyboard, below screenshot for  better understanding


4 -Visual mode :

We can eaisly select text and run command in this mode, we can switch in visual mode from  any mode by pressing " ESC " key and than Press "v"

for the example i want to delete top 4 line so in will select top four line by arrow key and then i will press "d" for delete.

How to switch mode in vi editor ?

We can switch mode in vi editor by pressing the below key form the keyboard 

Command mode  -   esc

Command mode to Command line mode -  : ( colon )

Command mode to Insert mode -  i or inc key 

Insert mode to command mode / command line mode - esc  and : colon

Command mode to Visual mode : v 

Visual mode to command mode : esc

Visual mode to insert mode : esc  and i

Insert mode to visual mode : esc  and v

and so fourth....

 

Thanks you !!

I  hope this topic  gave you
all the information you needed.  If you have any further
questions or would like more detailed directions feel free to contact
us using any of the following sources.We look forward to
talking to you.



Post a Comment

0Comments

Post a Comment (0)

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Check Now
Ok, Go it!