Vi Editor

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Vi Editor as PDF for free.

More details

  • Words: 398
  • Pages: 8
1

1

Editors

Editors are used for inserting or deleting text. Windows

: Notepad

DOS

: Edit

Linux/Unix CLI based

: EX , ED , VI

GUI based

: Emacs, Gedit, nedit, nano, pico

2

2

VI Editor modes

There are three modes of operations in VI Editor : Insert Mode Command Mode Execute Mode

3

3

VI Editor - Modes

Press Press Shift Shift+ +:: to to go go into into execute execute mode mode

Command Mode

Press Press i,i,II a, a,A, A,o, o,O O or orINSERT INSERT to to enter enter into into the the insert mode insert mode from from command commandmode mode

Press Press Press Press ESCAPE ESCAPE ESCAPE ESCAPEto come out from You can Insert Youto cansave save Insertyour your Execute Mode Mode to come out Insert from out from to come come outthe from yourtext here text excute mode yourtext here mode texthere here the excute mode the insert to the insert mode to to tocommand commandmode mode command commandmode mode 4

4

How to get into Insert Mode

i

- inserts the text at current cursor position

I

- inserts the text at beginning of line

a

- appends the text after current cursor position

A

- appends the text at end of line

o

- inserts a line below current cursor position

O

- inserts a line above current cursor position

r

- replace a single char at current cursor position

5

5

At Execute Mode

:q

- quit without saving

:q!

- quit forcefully without saving

:w

- save

:wq

- save & quit

:wq!

- save & quit forcefully

:x

- save & quit

Shift+ZZ

- save & quit

:sh

- Provides temporary shell

6

6

At Execute Mode

:set number

- Setting line numbers

:se nu

- Setting line numbers

:set nonumber

- Removing line numbers

:se nonu

- Removing line numbers

:84

- Press enter goes to line 84

7

7

Delete/Copy/Paste/Undo in command mode

dd

- Deletes a line

2dd

- Deletes 2 lines

yy

- Copy a line

2yy

- Copies 2 lines

p

- After deleting or copying, by pressing the deleted or copied contents will be pasted below the position of cursor.

u

- Undo (can undo 1000 times)

Ctrl+r

- Redo

G

- Moves cursor to last line of file

5G

- Moves cursor to 5th line of file 8

8

Related Documents

Vi Editor
November 2019 27
Vi Editor
November 2019 29
Vi Editor
October 2019 29
Vi Editor
November 2019 36
Vi Editor Commands
May 2020 13
Vi Editor Commands
November 2019 20