SlideShare a Scribd company logo
1 of 2
Download to read offline
vi editor basics
a Append text after cursor. h Move cursor left (left arrow; backspace)
A Append text at the end of the line. j Move cursor down (down arrow)
i Insert text before the cursor. k Move cursor up (up arrow)
I Insert text at the beginning of the line. l Move cursor right (right arrow, spacebar)
o Open a new line below the cursor.
O Open a new line above the cursor. H Move to top of screen.
w Move forward one word. M Move to middle of screen.
W Move forward one word past punctuation. L Move to bottom of screen.
b Move backward one word.
B Move backward one word past punctuation. CTRL-f Page forward one screen.
e Move forward at end of word. CTRL-d Scroll down one-half screen.
E Move forward at end of word past punctuation. CTRL-b Page back up one screen.
x Delete character at cursor. CTRL-u Scroll up one-half screen.
X Delete character left of cursor.
:5,10d Delete lines 5 through 10.
D Delete line to right of cursor. :1,3co 5 Copy lines 1 to 3; put after line 5.
dw Delete word right of cursor. :4,6m 8 Move lines 4 to 6 to line 8
ndw Delete n number of words.
dd Delete line containing the cursor. cw Change word.
ndd Delete n lines. ncw Change n words.
dG Delete to end of FILE. nyy Yank n lines (copy).
Y Yank current line.
R Overwrite characters on line. p Put yanked/deleted line(s) below current line.
r Replace one letter only. P Put yanked/deleted line(s) above current ilne.
C Change from cursor to end of line. :r insert_file Insert insert_file below the current line.
s Substitute string for character. :n r
insert_file
Insert insert_file after line number n.
J Join current line and line below current line.
xp Transpose/switch letters. u Undo previous command.
~ Change case of letter. U Undo all changes to current line.
:u Undo previous last line command.
:w Save changes.
:w new_file Save with name new_file :set nu Show line numbers.
:w! existing Overwrite existing file existing :set nonu Hide line numbers,
:wq Save changes and quit vi. :set ic Search ignore case.
ZZ Save changes and quit vi :set noic Search case sensitive
:q! Quit without saving. :set list Display invisible characters (tabs)
:set nolist Don't display invisible characters.
G Go to last line. :set showmode Show current mode of operation.
1G Go to first line of file. :set noshowmode Don't show current mode of operation.
:21 Go to line 21. CTRL-L Clear scrambled screen.
21G Go to line 21.
/string Search forward for string
?string Search backward for string
n Find next occurrence of string
N Find previous occurrence of string
:s/this/that Change first occurrence of this to that on current line.
:s/this/that/g Change all occurrences of this to that on current line.
:%s/this/that On all lines, change first occurrence of this to that.
:%s/this/that/g On all lines, change all occurrences of this to that.
vi Detailed Reference
Search Functions
/exp Go forward to exp
?exp Go backward to exp
Move and Insert Text
:3,8d Delete lines 3-8
:2,4m 9 Move lines 2-4 to 9
:2,4co 9 Copy lines 2-4 to 9
:5,9w file Write lines 5-9 to file
Substitution Functions
:s/old/new Change old to new
:%s/old/new/g Change all old to
new
Save Files and Exit
:w Write buffer to disk
:w newfile Write buffer to newfile
:w! file Write absolutely
:q Quit vi
:q! Quit absolutely
:e! Re-edit, discarding
changes
Control Edit Session
:set nu Display line numbers
:set nonu Don't show line numbers
:set all Show all settings
:set list Display invisible chars
:set showmode Display editing mode
Other Useful Features
:r file Read in file
:!command Execute shell command
:sh Exit to shell
:| Shell cmd results to file
ZZ Write and quit
Screen/Line Movement
j ↓ k ↑ h ← l →
0 Go to line start
$ Go to line end
G Go to last line in file
3G Go to line 3
CTRL-g Show line number
CTRL-f Go forward 1 screen
CTRL-b Go backward 1 screen
Word Movement
W Go forward 1 word
3W Go forward 3 words
B Go back 1 word
3B Go back 3 words
Search Functions
n Repeat previous search
N Reverse previous search
Delete Text
x Delete one character
dw Delete one word
dd Delete one line
D Delete to end of line
d0 Delete to beginning of line
dG Delete to end of file
Cancel/Redo Functions
u Undo last change
. Do last change again
Copy and Insert Text
Y Yank a copy of a line
5Y Yank a copy of 5 lines
p Put below cursor
P Put above cursor
Word Processing Functions
J Join next line to current
4J Join next 4 lines to current
Add/Append Text
a Append after cursor
A Append at line end
i Insert before cursor
5i Insert text 5 times
I Insert at beginning of line
Add New Lines
o Open a line below cursor
O Open a line above cursor
Change Text
cw Change a word
3cw Change 3 words
C Change line
r Replace one character
R Replace/type-over line
Last Line
Mode
Command
Mode Input
Mode
:/?
Enter
Esc
Input cmds

More Related Content

Similar to vi editor basics reference under 40 chars

015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdfssuser584832
 
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
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commandsFemi Adeyemi
 
Vi Editor Cheat Sheet
Vi Editor Cheat SheetVi Editor Cheat Sheet
Vi Editor Cheat SheetLoiane Groner
 
VI Editors
VI EditorsVI Editors
VI EditorsDeivanai
 
Rubizza #1 | Special Lecture. Vim
Rubizza #1 | Special Lecture. Vim Rubizza #1 | Special Lecture. Vim
Rubizza #1 | Special Lecture. Vim Rubizza
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editorJose Pla
 
Vim Cards - Powerpoint Format
Vim Cards - Powerpoint FormatVim Cards - Powerpoint Format
Vim Cards - Powerpoint FormatAdam Lowe
 
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 editorShourya Puri
 

Similar to vi editor basics reference under 40 chars (20)

Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf
 
Using vi editor
Using vi editorUsing vi editor
Using vi editor
 
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
 
vim-cheatsheet.pdf
vim-cheatsheet.pdfvim-cheatsheet.pdf
vim-cheatsheet.pdf
 
Vi editor
Vi editorVi editor
Vi editor
 
Vim Cheat Sheet.pdf
Vim Cheat Sheet.pdfVim Cheat Sheet.pdf
Vim Cheat Sheet.pdf
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commands
 
Vim
VimVim
Vim
 
Vi Editor Cheat Sheet
Vi Editor Cheat SheetVi Editor Cheat Sheet
Vi Editor Cheat Sheet
 
VI Editors
VI EditorsVI Editors
VI Editors
 
Rubizza #1 | Special Lecture. Vim
Rubizza #1 | Special Lecture. Vim Rubizza #1 | Special Lecture. Vim
Rubizza #1 | Special Lecture. Vim
 
API TEST
API TESTAPI TEST
API TEST
 
Vi Cheat Sheet
Vi Cheat SheetVi Cheat Sheet
Vi Cheat Sheet
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
API TEST
API TESTAPI TEST
API TEST
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editor
 
Vim Cards - Powerpoint Format
Vim Cards - Powerpoint FormatVim Cards - Powerpoint Format
Vim Cards - Powerpoint Format
 
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
 

Recently uploaded

Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 

Recently uploaded (20)

Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 

vi editor basics reference under 40 chars

  • 1. vi editor basics a Append text after cursor. h Move cursor left (left arrow; backspace) A Append text at the end of the line. j Move cursor down (down arrow) i Insert text before the cursor. k Move cursor up (up arrow) I Insert text at the beginning of the line. l Move cursor right (right arrow, spacebar) o Open a new line below the cursor. O Open a new line above the cursor. H Move to top of screen. w Move forward one word. M Move to middle of screen. W Move forward one word past punctuation. L Move to bottom of screen. b Move backward one word. B Move backward one word past punctuation. CTRL-f Page forward one screen. e Move forward at end of word. CTRL-d Scroll down one-half screen. E Move forward at end of word past punctuation. CTRL-b Page back up one screen. x Delete character at cursor. CTRL-u Scroll up one-half screen. X Delete character left of cursor. :5,10d Delete lines 5 through 10. D Delete line to right of cursor. :1,3co 5 Copy lines 1 to 3; put after line 5. dw Delete word right of cursor. :4,6m 8 Move lines 4 to 6 to line 8 ndw Delete n number of words. dd Delete line containing the cursor. cw Change word. ndd Delete n lines. ncw Change n words. dG Delete to end of FILE. nyy Yank n lines (copy). Y Yank current line. R Overwrite characters on line. p Put yanked/deleted line(s) below current line. r Replace one letter only. P Put yanked/deleted line(s) above current ilne. C Change from cursor to end of line. :r insert_file Insert insert_file below the current line. s Substitute string for character. :n r insert_file Insert insert_file after line number n. J Join current line and line below current line. xp Transpose/switch letters. u Undo previous command. ~ Change case of letter. U Undo all changes to current line. :u Undo previous last line command. :w Save changes. :w new_file Save with name new_file :set nu Show line numbers. :w! existing Overwrite existing file existing :set nonu Hide line numbers, :wq Save changes and quit vi. :set ic Search ignore case. ZZ Save changes and quit vi :set noic Search case sensitive :q! Quit without saving. :set list Display invisible characters (tabs) :set nolist Don't display invisible characters. G Go to last line. :set showmode Show current mode of operation. 1G Go to first line of file. :set noshowmode Don't show current mode of operation. :21 Go to line 21. CTRL-L Clear scrambled screen. 21G Go to line 21. /string Search forward for string ?string Search backward for string n Find next occurrence of string N Find previous occurrence of string :s/this/that Change first occurrence of this to that on current line. :s/this/that/g Change all occurrences of this to that on current line. :%s/this/that On all lines, change first occurrence of this to that. :%s/this/that/g On all lines, change all occurrences of this to that.
  • 2. vi Detailed Reference Search Functions /exp Go forward to exp ?exp Go backward to exp Move and Insert Text :3,8d Delete lines 3-8 :2,4m 9 Move lines 2-4 to 9 :2,4co 9 Copy lines 2-4 to 9 :5,9w file Write lines 5-9 to file Substitution Functions :s/old/new Change old to new :%s/old/new/g Change all old to new Save Files and Exit :w Write buffer to disk :w newfile Write buffer to newfile :w! file Write absolutely :q Quit vi :q! Quit absolutely :e! Re-edit, discarding changes Control Edit Session :set nu Display line numbers :set nonu Don't show line numbers :set all Show all settings :set list Display invisible chars :set showmode Display editing mode Other Useful Features :r file Read in file :!command Execute shell command :sh Exit to shell :| Shell cmd results to file ZZ Write and quit Screen/Line Movement j ↓ k ↑ h ← l → 0 Go to line start $ Go to line end G Go to last line in file 3G Go to line 3 CTRL-g Show line number CTRL-f Go forward 1 screen CTRL-b Go backward 1 screen Word Movement W Go forward 1 word 3W Go forward 3 words B Go back 1 word 3B Go back 3 words Search Functions n Repeat previous search N Reverse previous search Delete Text x Delete one character dw Delete one word dd Delete one line D Delete to end of line d0 Delete to beginning of line dG Delete to end of file Cancel/Redo Functions u Undo last change . Do last change again Copy and Insert Text Y Yank a copy of a line 5Y Yank a copy of 5 lines p Put below cursor P Put above cursor Word Processing Functions J Join next line to current 4J Join next 4 lines to current Add/Append Text a Append after cursor A Append at line end i Insert before cursor 5i Insert text 5 times I Insert at beginning of line Add New Lines o Open a line below cursor O Open a line above cursor Change Text cw Change a word 3cw Change 3 words C Change line r Replace one character R Replace/type-over line Last Line Mode Command Mode Input Mode :/? Enter Esc Input cmds