Vim Editor-Part I

This topic was published by and viewed 2502 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author
    Posts

  • Saptarshi Nag
    Participant
    • Topics - 6
    • @saptarshi

    The one of the most handy tools in Linux is the vi editor. We can write any text,script,code here and run through the command line in the Linux environment (provided the corresponding compiler or interpreter exists in the Linux system).

    [code]Vim=Vi improved[/code]

    Now it has the feature of syntax highlighting and many more features mixing those of gedit and vi.

    Generally ubuntu does not contain vim but we can download it for free through command line-

    [code]sudo apt-get install vim[/code]

    and done.

    And now we can open the editor through command-line-

    [code]vim <filename>[/code]

    We can omit filename here and give it after writing something in editor. Now vim editor it has three modes:

    1. Command mode
    2. Insert mode
    3. Last line mode

    In command mode we can edit, delete and do many operations. While opening vim it is always in command mode.

    In insert mode we can write text on the editor and edit the text.

    Last line mode is a part of command mode which is used to save the file and quit the environment of vi editor etc.

    Now we move from one mode to one mode through mere keyboard-

    [code]command mode -> insert mode= press 'i'

    command mode ->last line mode=press ':'

    insert mode -> command mode= 'Esc'

    insert mode -> last line mode='Esc' then ':'[/code]

    Again, for convenience we can go into insert mode by pressing 'o' or 'O'.
    [code]'o' -> enters into insert mode and opens a line below cursor

    'O'->enters into insert mode and opens a line above cursor[/code]

    whereas pressing 'i' enters into insert mode and opens a line on the cursor position.
    Now let's write some text there.

    Further Reading

    Check out DCJTech's official Facebook page - https://dcjtech.info/members/saptarshi/

Viewing 1 post (of 1 total)