SlideShare a Scribd company logo
EDITING TRICKS IN Vim EDITOR
Prepared by :
Ramnath Banerjee
ramnath@infidigits.com
http://www.infidigits.com
The Power of
dyp Design & Dev, Marketing, Conversion optimization
● Introduction
● Target Audience
● Section A > Delete or Cut
○ Delete (or Cut) Lines
○ Delete (or Cut) Lines (Editor mode)
○ Delete (or Cut) An Entire Paragraph
○ Delete (or Cut) Letters
○ Delete (or Cut) A Word
● Section B > Yank or Copy
○ Copy Lines
○ Copy Lines (Editor mode)
○ Copy An Entire Paragraph
○ Copy Letters
○ Copy A Word
Table Of Contents
● Section C > Paste
● Conclusion
● References
● About InfiDigits
Editing Tricks in Vim Editor: The Power of dyp InfiDigitsSlide 2 of 20
While editing files in the Vim editor, it often becomes tedious to systematically
cut, copy or paste large chunks or parts of a file since the editor doesn’t come
with a GUI interface. That’s when these simple yet effective tricks come
handy. These commands are inbuilt and once mastered, helps accomplish
editing tasks at the click of a button. Before we get started, open up a file in
the Vim editor.
Introduction
Slide 3 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Target Audience
Intended For
Programmers, DBAs,
Sys Admins
Beginner
Slide 4 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Difficulty Level
SECTION A > Delete or Cut
In this section we will learn the deletion commands, mostly performed using
d or D, in the normal or in the editor mode. Note that the same commands
simultaneously performs the actions of cutting as well.
Slide 5 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Delete (or Cut) Lines
1. Move your cursor to anywhere on the line you wish to delete.
2. Type dd or D to delete the current line completely.
3. Similarly if you wish to edit 15 lines, type dd or D 15 times. Alternatively
you may also type 15dd or 15D.
4. d$ deletes everything from the position of the cursor till the end of line.
dgg deletes everything from the position of the cursor till the beginning of
file. d3k deletes the line where the cursor is plus 3 lines above the
position of the cursor.
Slide 6 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Delete (or Cut) Lines (Editor mode)
1. Move your cursor to anywhere on the line you wish to delete.
2. Open editor mode by typing Shift + :
3. Type d and press the enter key to delete the current line.
4. To delete multiple lines you’ll need the following command -
<StartingLineNumber>,<EndingLineNumber>d.
5. Let’s say you wish to delete 6 lines. So type 36,41d to delete 6
consecutive lines including line numbers 36 and 41 and press the enter
key.
Slide 7 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Delete (or Cut) An Entire Paragraph
1. Move your cursor to the paragraph which you wish to delete.
2. Type dap or {d} to delete the paragraph.
Slide 8 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Delete (or Cut) Letters
1. Move your cursor to the point from where you wish to delete the letters.
2. Let’s assume you want to delete 5 letters. Just type d5l or 5x and you’re
done.
3. Incase you need to delete 5 letters before the cursor just like using the
<backspace>, type 5X.
Slide 9 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Delete (or Cut) A Word
1. Move your cursor to the beginning of the word you wish to delete.
2. Type dw or de to delete the word.
Slide 10 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
SECTION B > Yank or Copy
The easiest way to copy something in the Vim editor is by marking the string
using your keyboard or mouse. However, there are other complex routes to
achieve the same result. Follow the slides to learn more.
Slide 11 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Copy Lines
1. Move your cursor to anywhere on the line you wish to copy.
2. Type yy or Y to copy the current line completely.
3. Similarly if you wish to copy 15 lines, type yy or Y 15 times on the lines
you wish to copy. Alternatively you may also type 15yy or 15Y.
4. y$ copies everything from the position of the cursor till the end of line.
5. ygg copies everything from the position of the cursor till the beginning of
the file.
6. y3k copies the line where the cursor is plus 3 lines above the position of
the cursor.
Slide 12 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Copy Lines (Editor mode)
1. Move your cursor to anywhere on the line you wish to copy.
2. Open editor mode by typing Shift + :
3. Type y and press the enter key.
4. To copy multiple lines you’ll need the following command -
<StartingLineNumber>,<EndingLineNumber>y.
5. Let’s say you wish to copy 6 lines. Type 16,21y to copy 6 consecutive
lines including line numbers 16 and 21 and press the enter key.
Slide 13 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Copy An Entire Paragraph
1. Move your cursor to the paragraph which you wish to copy.
2. Type yap or {y} to copy the paragraph.
Slide 14 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Copy Letters
1. Move your cursor to the point from where you wish to copy the letters.
2. Let’s assume you want to copy 8 letters. Just type y8l and you’re done.
Slide 15 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Copy A Word
1. Move your cursor to the beginning of the word you wish to copy.
2. Type yw or ye to delete the word.
Slide 16 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
SECTION C > Paste
The easiest way to paste something somewhere in your Vim editor is by right
clicking using your touchpad or mouse. However, if you still want to use the
difficult route, type p or P. To paste something before the position of the
cursor type p and to paste something after the position of the cursor type P.
Slide 17 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
Conclusion
This presentation is limited to only the commands for delete/cut, yank or copy
& paste. You may explore all these and many more powerful commands such
as find, replace, change case, etc. in your Unix terminal by typing vimtutor
and by applying them on a regular basis. Also note that there are many
valuable online resources available in the internet which can also help you
become a Vim power user.
Slide 18 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
References
1. Inbuilt vimtutor tutorial.
2. http://unix.stackexchange.com/
3. http://vim.rtorr.com/
4. http://linuxconfig.org/vim-tutorial
Slide 19 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
About InfiDigits
InfiDigits is a digital marketing agency having
core competencies in web design &
development, digital marketing and
conversion optimization. Our mission is to
provide innovative, cost effective, ROI
focused web solutions.
Slide 20 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
http://www.infidigits.com
e: sales@infidigits.com
t: +91 9830824695
f: fb.com/infidigits
t: twitter.com/infidigits

More Related Content

Viewers also liked

Google+ Authorship and SEO
Google+ Authorship and SEOGoogle+ Authorship and SEO
Google+ Authorship and SEO
Nick Noble
 
Demand Activation – Going Beyond Lead Generation
 Demand Activation – Going Beyond Lead Generation Demand Activation – Going Beyond Lead Generation
Demand Activation – Going Beyond Lead Generation
Nick Noble
 
A Game Changing AdWords Account Audit
A Game Changing AdWords Account AuditA Game Changing AdWords Account Audit
A Game Changing AdWords Account Audit
Nick Noble
 
A Game Changing AdWords Account Audit
A Game Changing AdWords Account AuditA Game Changing AdWords Account Audit
A Game Changing AdWords Account Audit
Nick Noble
 
Google+authorship public
Google+authorship publicGoogle+authorship public
Google+authorship public
Nick Noble
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
LinkedIn
 

Viewers also liked (6)

Google+ Authorship and SEO
Google+ Authorship and SEOGoogle+ Authorship and SEO
Google+ Authorship and SEO
 
Demand Activation – Going Beyond Lead Generation
 Demand Activation – Going Beyond Lead Generation Demand Activation – Going Beyond Lead Generation
Demand Activation – Going Beyond Lead Generation
 
A Game Changing AdWords Account Audit
A Game Changing AdWords Account AuditA Game Changing AdWords Account Audit
A Game Changing AdWords Account Audit
 
A Game Changing AdWords Account Audit
A Game Changing AdWords Account AuditA Game Changing AdWords Account Audit
A Game Changing AdWords Account Audit
 
Google+authorship public
Google+authorship publicGoogle+authorship public
Google+authorship public
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Similar to Editing Tricks in Vim editor: The Power of dyp

Solidworks tips - First edition.pdf
Solidworks tips - First edition.pdfSolidworks tips - First edition.pdf
Solidworks tips - First edition.pdf
ZaheerAhmed905221
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
Sara Karaki
 
Vi editor in linux
Vi editor in linuxVi editor in linux
Vi editor in linux
Bhumivaghasiya
 
Vi editor
Vi editorVi editor
Vim Book
Vim BookVim Book
Vim Book
Maurício Sousa
 
Most Essential AutoCAD Commands
Most Essential AutoCAD CommandsMost Essential AutoCAD Commands
Most Essential AutoCAD Commands
Ravi Bhadauria
 
Skillsusa university (1)
Skillsusa university (1)Skillsusa university (1)
Skillsusa university (1)
Timer Ut
 
AJAY SHARMA autocad-summer-training-report.pdf
AJAY SHARMA autocad-summer-training-report.pdfAJAY SHARMA autocad-summer-training-report.pdf
AJAY SHARMA autocad-summer-training-report.pdf
YaarJani
 
Kodar-lan - Text and editors Vi/Vim
Kodar-lan - Text and editors Vi/VimKodar-lan - Text and editors Vi/Vim
Kodar-lan - Text and editors Vi/Vim
Tim Gremalm
 
Vi editor
Vi editorVi editor
Auto cad interface
Auto cad interfaceAuto cad interface
Auto cad interface
Mohit Goyal
 
AUTOCAD RAHUL
AUTOCAD  RAHULAUTOCAD  RAHUL
AUTOCAD RAHUL
RahulKumar5178
 
Practical work 5
Practical work 5Practical work 5
Practical work 5
wkhairil80
 
Libop Calculator for Android Features
Libop Calculator for Android FeaturesLibop Calculator for Android Features
Libop Calculator for Android Features
Woodgates E.I.R.L.
 
Autocad
AutocadAutocad
Autocad
actacademy
 
Text editor In RHEL
Text editor In RHELText editor In RHEL
Text editor In RHEL
Varnnit Jain
 
Autocad
AutocadAutocad
Autocad
ACT2013
 
Viva Questions for Engineering Dawing and Graphics
Viva Questions for Engineering Dawing and GraphicsViva Questions for Engineering Dawing and Graphics
Viva Questions for Engineering Dawing and Graphics
shyamranjan2006
 
Autodesk AutoCAD 2016
Autodesk AutoCAD 2016 Autodesk AutoCAD 2016
Autodesk AutoCAD 2016
masoud esfandiari
 
AutoCAD
AutoCADAutoCAD
AutoCAD
actanimation
 

Similar to Editing Tricks in Vim editor: The Power of dyp (20)

Solidworks tips - First edition.pdf
Solidworks tips - First edition.pdfSolidworks tips - First edition.pdf
Solidworks tips - First edition.pdf
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Vi editor in linux
Vi editor in linuxVi editor in linux
Vi editor in linux
 
Vi editor
Vi editorVi editor
Vi editor
 
Vim Book
Vim BookVim Book
Vim Book
 
Most Essential AutoCAD Commands
Most Essential AutoCAD CommandsMost Essential AutoCAD Commands
Most Essential AutoCAD Commands
 
Skillsusa university (1)
Skillsusa university (1)Skillsusa university (1)
Skillsusa university (1)
 
AJAY SHARMA autocad-summer-training-report.pdf
AJAY SHARMA autocad-summer-training-report.pdfAJAY SHARMA autocad-summer-training-report.pdf
AJAY SHARMA autocad-summer-training-report.pdf
 
Kodar-lan - Text and editors Vi/Vim
Kodar-lan - Text and editors Vi/VimKodar-lan - Text and editors Vi/Vim
Kodar-lan - Text and editors Vi/Vim
 
Vi editor
Vi editorVi editor
Vi editor
 
Auto cad interface
Auto cad interfaceAuto cad interface
Auto cad interface
 
AUTOCAD RAHUL
AUTOCAD  RAHULAUTOCAD  RAHUL
AUTOCAD RAHUL
 
Practical work 5
Practical work 5Practical work 5
Practical work 5
 
Libop Calculator for Android Features
Libop Calculator for Android FeaturesLibop Calculator for Android Features
Libop Calculator for Android Features
 
Autocad
AutocadAutocad
Autocad
 
Text editor In RHEL
Text editor In RHELText editor In RHEL
Text editor In RHEL
 
Autocad
AutocadAutocad
Autocad
 
Viva Questions for Engineering Dawing and Graphics
Viva Questions for Engineering Dawing and GraphicsViva Questions for Engineering Dawing and Graphics
Viva Questions for Engineering Dawing and Graphics
 
Autodesk AutoCAD 2016
Autodesk AutoCAD 2016 Autodesk AutoCAD 2016
Autodesk AutoCAD 2016
 
AutoCAD
AutoCADAutoCAD
AutoCAD
 

Recently uploaded

Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
Ayan Halder
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Julian Hyde
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 

Recently uploaded (20)

Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)Measures in SQL (SIGMOD 2024, Santiago, Chile)
Measures in SQL (SIGMOD 2024, Santiago, Chile)
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 

Editing Tricks in Vim editor: The Power of dyp

  • 1. EDITING TRICKS IN Vim EDITOR Prepared by : Ramnath Banerjee ramnath@infidigits.com http://www.infidigits.com The Power of dyp Design & Dev, Marketing, Conversion optimization
  • 2. ● Introduction ● Target Audience ● Section A > Delete or Cut ○ Delete (or Cut) Lines ○ Delete (or Cut) Lines (Editor mode) ○ Delete (or Cut) An Entire Paragraph ○ Delete (or Cut) Letters ○ Delete (or Cut) A Word ● Section B > Yank or Copy ○ Copy Lines ○ Copy Lines (Editor mode) ○ Copy An Entire Paragraph ○ Copy Letters ○ Copy A Word Table Of Contents ● Section C > Paste ● Conclusion ● References ● About InfiDigits Editing Tricks in Vim Editor: The Power of dyp InfiDigitsSlide 2 of 20
  • 3. While editing files in the Vim editor, it often becomes tedious to systematically cut, copy or paste large chunks or parts of a file since the editor doesn’t come with a GUI interface. That’s when these simple yet effective tricks come handy. These commands are inbuilt and once mastered, helps accomplish editing tasks at the click of a button. Before we get started, open up a file in the Vim editor. Introduction Slide 3 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 4. Target Audience Intended For Programmers, DBAs, Sys Admins Beginner Slide 4 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits Difficulty Level
  • 5. SECTION A > Delete or Cut In this section we will learn the deletion commands, mostly performed using d or D, in the normal or in the editor mode. Note that the same commands simultaneously performs the actions of cutting as well. Slide 5 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 6. Delete (or Cut) Lines 1. Move your cursor to anywhere on the line you wish to delete. 2. Type dd or D to delete the current line completely. 3. Similarly if you wish to edit 15 lines, type dd or D 15 times. Alternatively you may also type 15dd or 15D. 4. d$ deletes everything from the position of the cursor till the end of line. dgg deletes everything from the position of the cursor till the beginning of file. d3k deletes the line where the cursor is plus 3 lines above the position of the cursor. Slide 6 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 7. Delete (or Cut) Lines (Editor mode) 1. Move your cursor to anywhere on the line you wish to delete. 2. Open editor mode by typing Shift + : 3. Type d and press the enter key to delete the current line. 4. To delete multiple lines you’ll need the following command - <StartingLineNumber>,<EndingLineNumber>d. 5. Let’s say you wish to delete 6 lines. So type 36,41d to delete 6 consecutive lines including line numbers 36 and 41 and press the enter key. Slide 7 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 8. Delete (or Cut) An Entire Paragraph 1. Move your cursor to the paragraph which you wish to delete. 2. Type dap or {d} to delete the paragraph. Slide 8 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 9. Delete (or Cut) Letters 1. Move your cursor to the point from where you wish to delete the letters. 2. Let’s assume you want to delete 5 letters. Just type d5l or 5x and you’re done. 3. Incase you need to delete 5 letters before the cursor just like using the <backspace>, type 5X. Slide 9 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 10. Delete (or Cut) A Word 1. Move your cursor to the beginning of the word you wish to delete. 2. Type dw or de to delete the word. Slide 10 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 11. SECTION B > Yank or Copy The easiest way to copy something in the Vim editor is by marking the string using your keyboard or mouse. However, there are other complex routes to achieve the same result. Follow the slides to learn more. Slide 11 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 12. Copy Lines 1. Move your cursor to anywhere on the line you wish to copy. 2. Type yy or Y to copy the current line completely. 3. Similarly if you wish to copy 15 lines, type yy or Y 15 times on the lines you wish to copy. Alternatively you may also type 15yy or 15Y. 4. y$ copies everything from the position of the cursor till the end of line. 5. ygg copies everything from the position of the cursor till the beginning of the file. 6. y3k copies the line where the cursor is plus 3 lines above the position of the cursor. Slide 12 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 13. Copy Lines (Editor mode) 1. Move your cursor to anywhere on the line you wish to copy. 2. Open editor mode by typing Shift + : 3. Type y and press the enter key. 4. To copy multiple lines you’ll need the following command - <StartingLineNumber>,<EndingLineNumber>y. 5. Let’s say you wish to copy 6 lines. Type 16,21y to copy 6 consecutive lines including line numbers 16 and 21 and press the enter key. Slide 13 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 14. Copy An Entire Paragraph 1. Move your cursor to the paragraph which you wish to copy. 2. Type yap or {y} to copy the paragraph. Slide 14 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 15. Copy Letters 1. Move your cursor to the point from where you wish to copy the letters. 2. Let’s assume you want to copy 8 letters. Just type y8l and you’re done. Slide 15 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 16. Copy A Word 1. Move your cursor to the beginning of the word you wish to copy. 2. Type yw or ye to delete the word. Slide 16 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 17. SECTION C > Paste The easiest way to paste something somewhere in your Vim editor is by right clicking using your touchpad or mouse. However, if you still want to use the difficult route, type p or P. To paste something before the position of the cursor type p and to paste something after the position of the cursor type P. Slide 17 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 18. Conclusion This presentation is limited to only the commands for delete/cut, yank or copy & paste. You may explore all these and many more powerful commands such as find, replace, change case, etc. in your Unix terminal by typing vimtutor and by applying them on a regular basis. Also note that there are many valuable online resources available in the internet which can also help you become a Vim power user. Slide 18 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 19. References 1. Inbuilt vimtutor tutorial. 2. http://unix.stackexchange.com/ 3. http://vim.rtorr.com/ 4. http://linuxconfig.org/vim-tutorial Slide 19 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits
  • 20. About InfiDigits InfiDigits is a digital marketing agency having core competencies in web design & development, digital marketing and conversion optimization. Our mission is to provide innovative, cost effective, ROI focused web solutions. Slide 20 of 20 Editing Tricks in Vim Editor: The Power of dyp InfiDigits http://www.infidigits.com e: sales@infidigits.com t: +91 9830824695 f: fb.com/infidigits t: twitter.com/infidigits