SlideShare a Scribd company logo
1 of 2
Download to read offline
VI “Cheat” Sheet
                                                                                               ACNS Bulletin ED–03
                                                                                                   February 1995

                                  vi Editor “Cheat Sheet”
Invoking vi:                         vi filename
Format of vi commands:               [count][command]            (count repeats the effect of the command)

Command mode versus input mode                                   File management commands

Vi starts in command mode. The positioning commands               :w name         Write edit buffer to file name
operate only while vi is in command mode. You switch vi           :wq             Write to file and quit
to input mode by entering any one of several vi input com-        :q!             Quit without saving changes
mands. (See next section.) Once in input mode, any charac-        ZZ              Same as :wq
ter you type is taken to be text and is added to the file. You    :sh             Execute shell commands (<ctrl>d)
cannot execute any commands until you exit input mode.
To exit input mode, press the escape (Esc) key.
                                                                 Window motions
Input commands (end with Esc)                                     <ctrl>d         Scroll down (half a screen)
                                                                  <ctrl>u         Scroll up (half a screen)
 a                    Append after cursor
                                                                  <ctrl>f         Page forward
 i                    Insert before cursor
                                                                  <ctrl>b         Page backward
 o                    Open line below
                                                                  /string         Search forward
 O                    Open line above
                                                                  ?string         Search backward
 :r file              Insert file after current line
                                                                  <ctrl>l         Redraw screen
Any of these commands leaves vi in input mode until you           <ctrl>g         Display current line number and
press Esc. Pressing the RETURN key will not take you out                          file information
of input mode.
                                                                  n               Repeat search
                                                                  N               Repeat search reverse
Change commands (Input mode)                                      G               Go to last line
                                                                  nG              Go to line n
 cw                   Change word (Esc)
                                                                  :n              Go to line n
 cc                   Change line (Esc) - blanks line
                                                                  z<CR>           Reposition window: cursor at top
 c$                   Change to end of line
                                                                  z.              Reposition window: cursor in middle
 rc                   Replace character with c
                                                                  z-              Reposition window: cursor at bottom
 R                    Replace (Esc) - typeover
 s                    Substitute (Esc) - 1 char with string
 S                    Substitute (Esc) - Rest of line with       Cursor motions
                      text
                                                                  H               Upper left corner (home)
 .                    Repeat last change
                                                                  M               Middle line

Changes during insert mode
                                                                  L               Lower left corner
                                                                  h               Back a character
 <ctrl>h              Back one character                          j               Down a line
 <ctrl>w              Back one word                               k               Up a line
 <ctrl>u              Back to beginning of insert                 ^               Beginning of line
                                                                  $               End of line
                                                                  l               Forward a character
                                                                  w               One word forward
                                                                  b               Back one word
                                                                  fc              Find c
                                                                  ;               Repeat find (find next c)
Deletion commands                                         Move text from file old to file new
dd or ndd           Delete n lines to general buffer       vi old
dw                  Delete word to general buffer          “a10yy               yank 10 lines to buffer a
dnw                 Delete n words                         :w                   write work buffer
d)                  Delete to end of sentence              :e new               edit new file
db                  Delete previous word                   “ap                  put text from a after cursor
D                   Delete to end of line                  :30,60w new          Write lines 30 to 60 in file new
x                   Delete character
                                                          Regular expressions (search strings)
Recovering deletions
                                                           ^                    Matches beginning of line
p                   Put general buffer after cursor        $                    Matches end of line
P                   Put general buffer before cursor       .                    Matches any single character
                                                           *                    Matches any previous character
Undo commands                                              .*                   Matches any character

u                   Undo last change
                                                          Search and replace commands
U                   Undo all changes on line


Rearrangement commands
                                                          Syntax:
                                                                :[address]s/old_text/new_text/
yy or Y             Yank (copy) line to general buffer
“z6yy               Yank 6 lines to buffer z              Address components:
yw                  Yank word to general buffer            .               Current line
“a9dd               Delete 9 lines to buffer a             n               Line number n
“A9dd               Delete 9 lines; Append to buffer a     .+m             Current line plus m lines
“ap                 Put text from buffer a after cursor    $               Last line
p                   Put general buffer after cursor        /string/        A line that contains "string"
P                   Put general buffer before cursor       %               Entire file
J                   Join lines                             [addr1],[addr2] Specifies a range

                                                          Examples:
Parameters
                                                            The following example replaces only the first occur-
:set list           Show invisible characters               rence of Banana with Kumquat in each of 11 lines
:set nolist         Don’t show invisible characters         starting with the current line (.) and continuing for the
                                                            10 that follow (.+10).
:set number         Show line numbers
:set nonumber       Don’t show line numbers                     :.,.+10s/Banana/Kumquat

:set autoindent  Indent after carriage return               The following example replaces every occurrence
:set noautoindentTurn off autoindent                        (caused by the g at the end of the command) of
:set showmatch   Show matching sets of                      apple with pear.
                 parentheses as they are typed
:set noshowmatch Turn off showmatch                             :%s/apple/pear/g

:set showmode       Display mode on last line of screen     The following example removes the last character from
:set noshowmode     Turn off showmode                       every line in the file. Use it if every line in the file ends
:set all            Show values of all possible             with ^M as the result of a file transfer. Execute it
                    parameters                              when the cursor is on the first line of the file.
                                                                :%s/.$//

More Related Content

What's hot

Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scannerArif Ullah
 
File Handling In C++(OOPs))
File Handling In C++(OOPs))File Handling In C++(OOPs))
File Handling In C++(OOPs))Papu Kumar
 
Basic blocks and control flow graphs
Basic blocks and control flow graphsBasic blocks and control flow graphs
Basic blocks and control flow graphsTilakpoudel2
 
Java - Exception Handling
Java - Exception HandlingJava - Exception Handling
Java - Exception HandlingPrabhdeep Singh
 
Vi Editor Cheat Sheet
Vi Editor Cheat SheetVi Editor Cheat Sheet
Vi Editor Cheat SheetLoiane Groner
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automatonSampath Kumar S
 
1.python interpreter and interactive mode
1.python interpreter and interactive mode1.python interpreter and interactive mode
1.python interpreter and interactive modeManjuA8
 
File handling in_c
File handling in_cFile handling in_c
File handling in_csanya6900
 
File handling in C++
File handling in C++File handling in C++
File handling in C++Hitesh Kumar
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)SURBHI SAROHA
 
Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#Abid Kohistani
 
Multi catch statement
Multi catch statementMulti catch statement
Multi catch statementmyrajendra
 
Ppt on this and super keyword
Ppt on this and super keywordPpt on this and super keyword
Ppt on this and super keywordtanu_jaswal
 

What's hot (20)

COMPILER DESIGN- Syntax Directed Translation
COMPILER DESIGN- Syntax Directed TranslationCOMPILER DESIGN- Syntax Directed Translation
COMPILER DESIGN- Syntax Directed Translation
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scanner
 
File Handling In C++(OOPs))
File Handling In C++(OOPs))File Handling In C++(OOPs))
File Handling In C++(OOPs))
 
Basic blocks and control flow graphs
Basic blocks and control flow graphsBasic blocks and control flow graphs
Basic blocks and control flow graphs
 
Java - Exception Handling
Java - Exception HandlingJava - Exception Handling
Java - Exception Handling
 
Résumer arithmétique
Résumer arithmétiqueRésumer arithmétique
Résumer arithmétique
 
Vi Editor Cheat Sheet
Vi Editor Cheat SheetVi Editor Cheat Sheet
Vi Editor Cheat Sheet
 
1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton1.3.2 non deterministic finite automaton
1.3.2 non deterministic finite automaton
 
1.python interpreter and interactive mode
1.python interpreter and interactive mode1.python interpreter and interactive mode
1.python interpreter and interactive mode
 
TOC 5 | Regular Expressions
TOC 5 | Regular ExpressionsTOC 5 | Regular Expressions
TOC 5 | Regular Expressions
 
File handling in_c
File handling in_cFile handling in_c
File handling in_c
 
File handling in C++
File handling in C++File handling in C++
File handling in C++
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Java programming(unit 1)
Java programming(unit 1)Java programming(unit 1)
Java programming(unit 1)
 
Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#Polymorphism in C# Function overloading in C#
Polymorphism in C# Function overloading in C#
 
PHP - Introduction to File Handling with PHP
PHP -  Introduction to  File Handling with PHPPHP -  Introduction to  File Handling with PHP
PHP - Introduction to File Handling with PHP
 
Multi catch statement
Multi catch statementMulti catch statement
Multi catch statement
 
Java Script ppt
Java Script pptJava Script ppt
Java Script ppt
 
Ppt on this and super keyword
Ppt on this and super keywordPpt on this and super keyword
Ppt on this and super keyword
 

Viewers also liked

Exercicios Filas (Queues) - Estruturas de dados e algoritmos com Java
Exercicios Filas (Queues) - Estruturas de dados e algoritmos com JavaExercicios Filas (Queues) - Estruturas de dados e algoritmos com Java
Exercicios Filas (Queues) - Estruturas de dados e algoritmos com JavaLoiane Groner
 
[Curso Java Básico] Exercícios Aulas 11 12 13
[Curso Java Básico] Exercícios Aulas 11 12 13[Curso Java Básico] Exercícios Aulas 11 12 13
[Curso Java Básico] Exercícios Aulas 11 12 13Loiane Groner
 
Introducao ao Ionic 2 na pratica
Introducao ao Ionic 2 na praticaIntroducao ao Ionic 2 na pratica
Introducao ao Ionic 2 na praticaLoiane Groner
 
Loiane - Jornal A Tribuna - Maio 2008
Loiane - Jornal A Tribuna - Maio 2008Loiane - Jornal A Tribuna - Maio 2008
Loiane - Jornal A Tribuna - Maio 2008Loiane Groner
 
Exercicios Pilhas (Stacks) - Estruturas de dados e algoritmos com Java
Exercicios Pilhas (Stacks) - Estruturas de dados e algoritmos com JavaExercicios Pilhas (Stacks) - Estruturas de dados e algoritmos com Java
Exercicios Pilhas (Stacks) - Estruturas de dados e algoritmos com JavaLoiane Groner
 
[Curso Java Basico] Exercicios Aula 20
[Curso Java Basico] Exercicios Aula 20[Curso Java Basico] Exercicios Aula 20
[Curso Java Basico] Exercicios Aula 20Loiane Groner
 
[Curso Java Basico] Exercicios Aulas 16 17
[Curso Java Basico] Exercicios Aulas 16 17[Curso Java Basico] Exercicios Aulas 16 17
[Curso Java Basico] Exercicios Aulas 16 17Loiane Groner
 
Exercicios Vetores (Arrays) - Estruturas de dados e algoritmos com Java
Exercicios Vetores (Arrays) - Estruturas de dados e algoritmos com JavaExercicios Vetores (Arrays) - Estruturas de dados e algoritmos com Java
Exercicios Vetores (Arrays) - Estruturas de dados e algoritmos com JavaLoiane Groner
 
[Curso Java Basico] Exercicios Aulas 47 a 52
[Curso Java Basico] Exercicios Aulas 47 a 52[Curso Java Basico] Exercicios Aulas 47 a 52
[Curso Java Basico] Exercicios Aulas 47 a 52Loiane Groner
 
[Curso Java Basico] Exercicios Aulas 36 a 43
[Curso Java Basico] Exercicios Aulas 36 a 43[Curso Java Basico] Exercicios Aulas 36 a 43
[Curso Java Basico] Exercicios Aulas 36 a 43Loiane Groner
 
[Curso Java Basico] Exercicios Aulas 44 a 46
[Curso Java Basico] Exercicios Aulas 44 a 46[Curso Java Basico] Exercicios Aulas 44 a 46
[Curso Java Basico] Exercicios Aulas 44 a 46Loiane Groner
 
[Curso Java Basico] Exercicios Aula 36
[Curso Java Basico] Exercicios Aula 36[Curso Java Basico] Exercicios Aula 36
[Curso Java Basico] Exercicios Aula 36Loiane Groner
 
[Curso Java Basico] Exercicios Aulas 25 a 27
[Curso Java Basico] Exercicios Aulas 25 a 27[Curso Java Basico] Exercicios Aulas 25 a 27
[Curso Java Basico] Exercicios Aulas 25 a 27Loiane Groner
 
[Curso Java Basico] Exercicios Aula 24
[Curso Java Basico] Exercicios Aula 24[Curso Java Basico] Exercicios Aula 24
[Curso Java Basico] Exercicios Aula 24Loiane Groner
 
[Curso Java Basico] Exercicios Aula 34
[Curso Java Basico] Exercicios Aula 34[Curso Java Basico] Exercicios Aula 34
[Curso Java Basico] Exercicios Aula 34Loiane Groner
 
[Curso Java Basico] Exercicios Aula 35
[Curso Java Basico] Exercicios Aula 35[Curso Java Basico] Exercicios Aula 35
[Curso Java Basico] Exercicios Aula 35Loiane Groner
 
[Curso Java Basico] Exercicios Aulas 28 a 33
[Curso Java Basico] Exercicios Aulas 28 a 33[Curso Java Basico] Exercicios Aulas 28 a 33
[Curso Java Basico] Exercicios Aulas 28 a 33Loiane Groner
 
[Curso Java Basico] Exercicios Aulas 14 15
[Curso Java Basico] Exercicios Aulas 14 15[Curso Java Basico] Exercicios Aulas 14 15
[Curso Java Basico] Exercicios Aulas 14 15Loiane Groner
 
[Curso Java Basico] Exercicios Aula 19
[Curso Java Basico] Exercicios Aula 19[Curso Java Basico] Exercicios Aula 19
[Curso Java Basico] Exercicios Aula 19Loiane Groner
 

Viewers also liked (20)

Exercicios Filas (Queues) - Estruturas de dados e algoritmos com Java
Exercicios Filas (Queues) - Estruturas de dados e algoritmos com JavaExercicios Filas (Queues) - Estruturas de dados e algoritmos com Java
Exercicios Filas (Queues) - Estruturas de dados e algoritmos com Java
 
[Curso Java Básico] Exercícios Aulas 11 12 13
[Curso Java Básico] Exercícios Aulas 11 12 13[Curso Java Básico] Exercícios Aulas 11 12 13
[Curso Java Básico] Exercícios Aulas 11 12 13
 
Introducao ao Ionic 2 na pratica
Introducao ao Ionic 2 na praticaIntroducao ao Ionic 2 na pratica
Introducao ao Ionic 2 na pratica
 
vi cheat sheet
vi cheat sheetvi cheat sheet
vi cheat sheet
 
Loiane - Jornal A Tribuna - Maio 2008
Loiane - Jornal A Tribuna - Maio 2008Loiane - Jornal A Tribuna - Maio 2008
Loiane - Jornal A Tribuna - Maio 2008
 
Exercicios Pilhas (Stacks) - Estruturas de dados e algoritmos com Java
Exercicios Pilhas (Stacks) - Estruturas de dados e algoritmos com JavaExercicios Pilhas (Stacks) - Estruturas de dados e algoritmos com Java
Exercicios Pilhas (Stacks) - Estruturas de dados e algoritmos com Java
 
[Curso Java Basico] Exercicios Aula 20
[Curso Java Basico] Exercicios Aula 20[Curso Java Basico] Exercicios Aula 20
[Curso Java Basico] Exercicios Aula 20
 
[Curso Java Basico] Exercicios Aulas 16 17
[Curso Java Basico] Exercicios Aulas 16 17[Curso Java Basico] Exercicios Aulas 16 17
[Curso Java Basico] Exercicios Aulas 16 17
 
Exercicios Vetores (Arrays) - Estruturas de dados e algoritmos com Java
Exercicios Vetores (Arrays) - Estruturas de dados e algoritmos com JavaExercicios Vetores (Arrays) - Estruturas de dados e algoritmos com Java
Exercicios Vetores (Arrays) - Estruturas de dados e algoritmos com Java
 
[Curso Java Basico] Exercicios Aulas 47 a 52
[Curso Java Basico] Exercicios Aulas 47 a 52[Curso Java Basico] Exercicios Aulas 47 a 52
[Curso Java Basico] Exercicios Aulas 47 a 52
 
[Curso Java Basico] Exercicios Aulas 36 a 43
[Curso Java Basico] Exercicios Aulas 36 a 43[Curso Java Basico] Exercicios Aulas 36 a 43
[Curso Java Basico] Exercicios Aulas 36 a 43
 
[Curso Java Basico] Exercicios Aulas 44 a 46
[Curso Java Basico] Exercicios Aulas 44 a 46[Curso Java Basico] Exercicios Aulas 44 a 46
[Curso Java Basico] Exercicios Aulas 44 a 46
 
[Curso Java Basico] Exercicios Aula 36
[Curso Java Basico] Exercicios Aula 36[Curso Java Basico] Exercicios Aula 36
[Curso Java Basico] Exercicios Aula 36
 
[Curso Java Basico] Exercicios Aulas 25 a 27
[Curso Java Basico] Exercicios Aulas 25 a 27[Curso Java Basico] Exercicios Aulas 25 a 27
[Curso Java Basico] Exercicios Aulas 25 a 27
 
[Curso Java Basico] Exercicios Aula 24
[Curso Java Basico] Exercicios Aula 24[Curso Java Basico] Exercicios Aula 24
[Curso Java Basico] Exercicios Aula 24
 
[Curso Java Basico] Exercicios Aula 34
[Curso Java Basico] Exercicios Aula 34[Curso Java Basico] Exercicios Aula 34
[Curso Java Basico] Exercicios Aula 34
 
[Curso Java Basico] Exercicios Aula 35
[Curso Java Basico] Exercicios Aula 35[Curso Java Basico] Exercicios Aula 35
[Curso Java Basico] Exercicios Aula 35
 
[Curso Java Basico] Exercicios Aulas 28 a 33
[Curso Java Basico] Exercicios Aulas 28 a 33[Curso Java Basico] Exercicios Aulas 28 a 33
[Curso Java Basico] Exercicios Aulas 28 a 33
 
[Curso Java Basico] Exercicios Aulas 14 15
[Curso Java Basico] Exercicios Aulas 14 15[Curso Java Basico] Exercicios Aulas 14 15
[Curso Java Basico] Exercicios Aulas 14 15
 
[Curso Java Basico] Exercicios Aula 19
[Curso Java Basico] Exercicios Aula 19[Curso Java Basico] Exercicios Aula 19
[Curso Java Basico] Exercicios Aula 19
 

Similar to Vi Cheat Sheet

Similar to Vi Cheat Sheet (20)

Vi help-sheet-011
Vi help-sheet-011Vi help-sheet-011
Vi help-sheet-011
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
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-cheatsheet.pdf
vim-cheatsheet.pdfvim-cheatsheet.pdf
vim-cheatsheet.pdf
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commands
 
Vi CheatSheet
Vi CheatSheetVi CheatSheet
Vi CheatSheet
 
Vi reference
Vi referenceVi reference
Vi reference
 
Vi reference
Vi referenceVi reference
Vi reference
 
Vim Cheat Sheet.pdf
Vim Cheat Sheet.pdfVim Cheat Sheet.pdf
Vim Cheat Sheet.pdf
 
Vim 1
Vim 1Vim 1
Vim 1
 
UNIX - Class2 - vi Editor
UNIX - Class2 - vi EditorUNIX - Class2 - vi Editor
UNIX - Class2 - vi Editor
 
Vi editor
Vi editorVi editor
Vi editor
 
vim - Tips and_tricks
vim - Tips and_tricksvim - Tips and_tricks
vim - Tips and_tricks
 
1359 Vi Editor
1359 Vi Editor1359 Vi Editor
1359 Vi Editor
 
GNU Emacs Reference Card.pdf
GNU Emacs Reference Card.pdfGNU Emacs Reference Card.pdf
GNU Emacs Reference Card.pdf
 
015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf
 
Vim Cards - Keynote Format
Vim Cards - Keynote FormatVim Cards - Keynote Format
Vim Cards - Keynote Format
 
VI Editors
VI EditorsVI Editors
VI Editors
 

Recently uploaded

Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.YounusS2
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 

Recently uploaded (20)

Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.Basic Building Blocks of Internet of Things.
Basic Building Blocks of Internet of Things.
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 

Vi Cheat Sheet

  • 1. VI “Cheat” Sheet ACNS Bulletin ED–03 February 1995 vi Editor “Cheat Sheet” Invoking vi: vi filename Format of vi commands: [count][command] (count repeats the effect of the command) Command mode versus input mode File management commands Vi starts in command mode. The positioning commands :w name Write edit buffer to file name operate only while vi is in command mode. You switch vi :wq Write to file and quit to input mode by entering any one of several vi input com- :q! Quit without saving changes mands. (See next section.) Once in input mode, any charac- ZZ Same as :wq ter you type is taken to be text and is added to the file. You :sh Execute shell commands (<ctrl>d) cannot execute any commands until you exit input mode. To exit input mode, press the escape (Esc) key. Window motions Input commands (end with Esc) <ctrl>d Scroll down (half a screen) <ctrl>u Scroll up (half a screen) a Append after cursor <ctrl>f Page forward i Insert before cursor <ctrl>b Page backward o Open line below /string Search forward O Open line above ?string Search backward :r file Insert file after current line <ctrl>l Redraw screen Any of these commands leaves vi in input mode until you <ctrl>g Display current line number and press Esc. Pressing the RETURN key will not take you out file information of input mode. n Repeat search N Repeat search reverse Change commands (Input mode) G Go to last line nG Go to line n cw Change word (Esc) :n Go to line n cc Change line (Esc) - blanks line z<CR> Reposition window: cursor at top c$ Change to end of line z. Reposition window: cursor in middle rc Replace character with c z- Reposition window: cursor at bottom R Replace (Esc) - typeover s Substitute (Esc) - 1 char with string S Substitute (Esc) - Rest of line with Cursor motions text H Upper left corner (home) . Repeat last change M Middle line Changes during insert mode L Lower left corner h Back a character <ctrl>h Back one character j Down a line <ctrl>w Back one word k Up a line <ctrl>u Back to beginning of insert ^ Beginning of line $ End of line l Forward a character w One word forward b Back one word fc Find c ; Repeat find (find next c)
  • 2. Deletion commands Move text from file old to file new dd or ndd Delete n lines to general buffer vi old dw Delete word to general buffer “a10yy yank 10 lines to buffer a dnw Delete n words :w write work buffer d) Delete to end of sentence :e new edit new file db Delete previous word “ap put text from a after cursor D Delete to end of line :30,60w new Write lines 30 to 60 in file new x Delete character Regular expressions (search strings) Recovering deletions ^ Matches beginning of line p Put general buffer after cursor $ Matches end of line P Put general buffer before cursor . Matches any single character * Matches any previous character Undo commands .* Matches any character u Undo last change Search and replace commands U Undo all changes on line Rearrangement commands Syntax: :[address]s/old_text/new_text/ yy or Y Yank (copy) line to general buffer “z6yy Yank 6 lines to buffer z Address components: yw Yank word to general buffer . Current line “a9dd Delete 9 lines to buffer a n Line number n “A9dd Delete 9 lines; Append to buffer a .+m Current line plus m lines “ap Put text from buffer a after cursor $ Last line p Put general buffer after cursor /string/ A line that contains "string" P Put general buffer before cursor % Entire file J Join lines [addr1],[addr2] Specifies a range Examples: Parameters The following example replaces only the first occur- :set list Show invisible characters rence of Banana with Kumquat in each of 11 lines :set nolist Don’t show invisible characters starting with the current line (.) and continuing for the 10 that follow (.+10). :set number Show line numbers :set nonumber Don’t show line numbers :.,.+10s/Banana/Kumquat :set autoindent Indent after carriage return The following example replaces every occurrence :set noautoindentTurn off autoindent (caused by the g at the end of the command) of :set showmatch Show matching sets of apple with pear. parentheses as they are typed :set noshowmatch Turn off showmatch :%s/apple/pear/g :set showmode Display mode on last line of screen The following example removes the last character from :set noshowmode Turn off showmode every line in the file. Use it if every line in the file ends :set all Show values of all possible with ^M as the result of a file transfer. Execute it parameters when the cursor is on the first line of the file. :%s/.$//