SlideShare a Scribd company logo
Vim Editor
Command mode :

ZZ (save and exit)

 :e!
 wipe out all of the edits you have made in a
session and then return to the original file

You want to write a file, but you don’t have write
permission for it. You get the message
“Permission denied.”

:w <newfile>
to write out the buffer into a new file
●   $ --> go to the end of line
●   0 --> go to the start of the line
●   w--> move cursor by word
●   B--> move cursor backwd by word
●   1G-->top of the file
●   G --> end of file
●   Line-no+G --> go to particaular line
●
Changing Text
●   cw
    To the end of a word
●   c2b
    Back two words
●   c$
    To the end of line
●   c0
    To the beginning of line
●    cc : to change the entire line
●   C (capital) is same as c$
●




●
Deletion
●   dd : to delete whole line
●   dw : delete the word from the current cursor
    position to the end and space after word also.
●   de : same as dw except it does not remove
    blank space after word. Does not remove
    punctation mark.
●   dE: same as de but also remove punctuation
    mark.
●   D0 : delete from cursor position to the
    begining of line.
●   D$ : remove from cursor position till end of
    line.
Undo

●   u
    to undo the last command (for example,
    a dd)
●   U
    restore the line to its pristine state
●   p command
●   vi saves the last nine deletions in nine numbered deletion buffers.
    3p
    to “put” the contents of buffer number 3 on the line below the cursor.
Join 2 lines

●   J:
    merge the next line to the current line
●   numeric argument with J joins that number of
    consecutive lines.
●   joined three lines by using the command 3J.
●
Changing case

●   The tilde (~) command will change a
    lowercase letter to uppercase or an uppercase
    letter to lowercase.
Movement by text block
●   e move to the end of word.
●   E Move to end of word (ignore punctuation).
●   ( Move to beginning of current sentence.
●   ) Move to beginning of next sentence.
●   { Move to beginning of current paragraph.
●   } Move to beginning of next paragraph.
●
●   :set ic (ignore case)
●   :set noic
●   :set window=20 (no. Of lines shown in screen)
●   :set all ( list the complete set of options)
Executing Unix Commands
●   :!command
    ! tell ex to create a shell and follows as a unix
    command
●   :sh create a shell for return back to vi
    CTRL-D
●   :r !command
    read the results of unix coomand into your
    file.
●   :r filename
●   Add the content of file given to current file
●   :r !sort filename
●   13,19!sort
    pass the lines 13 to 19 to sort filter and
    replace with sort output.
●   Word Abbrevation
    :ab abbr phrase
    abbr is an abbreviation for the specified
    phrase. The sequence of characters that
    makeup the abbreviation will be expanded in
    insert mode only if you type it as a full word
    abbr will not be expanded within a word
●   :unab abbr -> disable the abbrevation
●   :ab -> list all abbrevation
●
●   :map x sequence
    Define character x as a sequence of editing commands.
●   :unmap x
    Disable the sequence defined for x.
●   :map
    List the characters that are currently mapped.
●   Example - > :map v dwelp
    enables you to reverse the order of two words at any
    time in the editing session with the single keystroke v.
    delete word, dw; move to the end of next word, e; move
    one space to the right, l; put the deleted word there, p.
●


●


●
Using ex Scripts

●   %s/thier/their/g
    %s/writeable/writable/g
    wq { exscript file }
●   From vim :so exscript
●   From coomand line :
     ex -s filename < exscript
●
●   Create view
    :mkview
●   Load view
    :loadview

More Related Content

What's hot

Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 1alish sha
 
Get your lost files from pendrive
Get your lost files from pendriveGet your lost files from pendrive
Get your lost files from pendriveramu068
 
1359 Vi Editor
1359 Vi Editor1359 Vi Editor
1359 Vi Editor
techbed
 
Vi editor
Vi editorVi editor
Vi editor
Ramakrishna kapa
 
20090622 Vimm4
20090622 Vimm420090622 Vimm4
20090622 Vimm4id774
 
Pivorak Clojure by Dmytro Bignyak
Pivorak Clojure by Dmytro BignyakPivorak Clojure by Dmytro Bignyak
Pivorak Clojure by Dmytro Bignyak
Pivorak MeetUp
 
Linux Command Line Multitasking
Linux Command Line MultitaskingLinux Command Line Multitasking
Linux Command Line Multitasking
Amr Fawzy
 

What's hot (12)

Test 1 alish schema 1
Test 1 alish schema 1Test 1 alish schema 1
Test 1 alish schema 1
 
Get your lost files from pendrive
Get your lost files from pendriveGet your lost files from pendrive
Get your lost files from pendrive
 
1359 Vi Editor
1359 Vi Editor1359 Vi Editor
1359 Vi Editor
 
Vi editor
Vi editorVi editor
Vi editor
 
Vi editor
Vi   editorVi   editor
Vi editor
 
Job09
Job09Job09
Job09
 
20090622 Vimm4
20090622 Vimm420090622 Vimm4
20090622 Vimm4
 
Pivorak Clojure by Dmytro Bignyak
Pivorak Clojure by Dmytro BignyakPivorak Clojure by Dmytro Bignyak
Pivorak Clojure by Dmytro Bignyak
 
Linux Command Line Multitasking
Linux Command Line MultitaskingLinux Command Line Multitasking
Linux Command Line Multitasking
 
Vicom
VicomVicom
Vicom
 
week-20x
week-20xweek-20x
week-20x
 
Kelompok 4
Kelompok 4Kelompok 4
Kelompok 4
 

Similar to Vim

Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vimsambismo
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
Farrukh Salman
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
Kopi Maheswaran
 
VIM for (PHP) Programmers
VIM for (PHP) ProgrammersVIM for (PHP) Programmers
VIM for (PHP) Programmers
ZendCon
 
Using VI Editor in Red Hat by Rohit Kumar
Using VI Editor in Red Hat by Rohit KumarUsing VI Editor in Red Hat by Rohit Kumar
Using VI Editor in Red Hat by Rohit KumarRohit Kumar
 
Linux shell
Linux shellLinux shell
Linux shell
Kenny (netman)
 
Vi editor
Vi editorVi editor
changing and deleting text ,change word and line under vi editor
changing and deleting text ,change word and line under vi editorchanging and deleting text ,change word and line under vi editor
changing and deleting text ,change word and line under vi editor
Shourya Puri
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
Shay Cohen
 
VIM for Programmers
VIM for ProgrammersVIM for Programmers
VIM for Programmers
Akash Agrawal
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editor
Jose Pla
 
015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf
ssuser584832
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regx
Kenny (netman)
 
3.8.b vim reference card
3.8.b vim reference card3.8.b vim reference card
3.8.b vim reference card
Acácio Oliveira
 
101 3.8.2 vim reference card
101 3.8.2 vim reference card101 3.8.2 vim reference card
101 3.8.2 vim reference card
Acácio Oliveira
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commands
Femi Adeyemi
 
Vi Editor
Vi EditorVi Editor

Similar to Vim (20)

Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vim
 
Vi reference
Vi referenceVi reference
Vi reference
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
VIM for (PHP) Programmers
VIM for (PHP) ProgrammersVIM for (PHP) Programmers
VIM for (PHP) Programmers
 
Using VI Editor in Red Hat by Rohit Kumar
Using VI Editor in Red Hat by Rohit KumarUsing VI Editor in Red Hat by Rohit Kumar
Using VI Editor in Red Hat by Rohit Kumar
 
Using vi editor
Using vi editorUsing vi editor
Using vi editor
 
Vim For Php
Vim For PhpVim For Php
Vim For Php
 
Linux shell
Linux shellLinux shell
Linux shell
 
Vi editor
Vi editorVi editor
Vi editor
 
changing and deleting text ,change word and line under vi editor
changing and deleting text ,change word and line under vi editorchanging and deleting text ,change word and line under vi editor
changing and deleting text ,change word and line under vi editor
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
 
VIM for Programmers
VIM for ProgrammersVIM for Programmers
VIM for Programmers
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editor
 
015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regx
 
3.8.b vim reference card
3.8.b vim reference card3.8.b vim reference card
3.8.b vim reference card
 
101 3.8.2 vim reference card
101 3.8.2 vim reference card101 3.8.2 vim reference card
101 3.8.2 vim reference card
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commands
 
Vi Editor
Vi EditorVi Editor
Vi Editor
 

Recently uploaded

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 

Recently uploaded (20)

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 

Vim

  • 1. Vim Editor Command mode : ZZ (save and exit) :e! wipe out all of the edits you have made in a session and then return to the original file You want to write a file, but you don’t have write permission for it. You get the message “Permission denied.” :w <newfile> to write out the buffer into a new file
  • 2. $ --> go to the end of line ● 0 --> go to the start of the line ● w--> move cursor by word ● B--> move cursor backwd by word ● 1G-->top of the file ● G --> end of file ● Line-no+G --> go to particaular line ●
  • 3. Changing Text ● cw To the end of a word ● c2b Back two words ● c$ To the end of line ● c0 To the beginning of line ● cc : to change the entire line ● C (capital) is same as c$ ● ●
  • 4. Deletion ● dd : to delete whole line ● dw : delete the word from the current cursor position to the end and space after word also. ● de : same as dw except it does not remove blank space after word. Does not remove punctation mark. ● dE: same as de but also remove punctuation mark. ● D0 : delete from cursor position to the begining of line. ● D$ : remove from cursor position till end of line.
  • 5. Undo ● u to undo the last command (for example, a dd) ● U restore the line to its pristine state ● p command ● vi saves the last nine deletions in nine numbered deletion buffers. 3p to “put” the contents of buffer number 3 on the line below the cursor.
  • 6. Join 2 lines ● J: merge the next line to the current line ● numeric argument with J joins that number of consecutive lines. ● joined three lines by using the command 3J. ●
  • 7. Changing case ● The tilde (~) command will change a lowercase letter to uppercase or an uppercase letter to lowercase.
  • 8. Movement by text block ● e move to the end of word. ● E Move to end of word (ignore punctuation). ● ( Move to beginning of current sentence. ● ) Move to beginning of next sentence. ● { Move to beginning of current paragraph. ● } Move to beginning of next paragraph. ●
  • 9. :set ic (ignore case) ● :set noic ● :set window=20 (no. Of lines shown in screen) ● :set all ( list the complete set of options)
  • 10. Executing Unix Commands ● :!command ! tell ex to create a shell and follows as a unix command ● :sh create a shell for return back to vi CTRL-D ● :r !command read the results of unix coomand into your file. ● :r filename ● Add the content of file given to current file ● :r !sort filename
  • 11. 13,19!sort pass the lines 13 to 19 to sort filter and replace with sort output. ● Word Abbrevation :ab abbr phrase abbr is an abbreviation for the specified phrase. The sequence of characters that makeup the abbreviation will be expanded in insert mode only if you type it as a full word abbr will not be expanded within a word ● :unab abbr -> disable the abbrevation ● :ab -> list all abbrevation ●
  • 12. :map x sequence Define character x as a sequence of editing commands. ● :unmap x Disable the sequence defined for x. ● :map List the characters that are currently mapped. ● Example - > :map v dwelp enables you to reverse the order of two words at any time in the editing session with the single keystroke v. delete word, dw; move to the end of next word, e; move one space to the right, l; put the deleted word there, p. ● ● ●
  • 13. Using ex Scripts ● %s/thier/their/g %s/writeable/writable/g wq { exscript file } ● From vim :so exscript ● From coomand line : ex -s filename < exscript ●
  • 14. Create view :mkview ● Load view :loadview