SlideShare a Scribd company logo
1 of 22
What is Vim?

 Advanced programmer‘s text editor

 Designed expressly for efficient text editing

 IDE-like features not built-in, but 1000‘s of plugins

 Highly customizable and extensible

 Incredibly powerful—will double or triple your
  productivity!

 Steep learning curve—takes years to master
Installing Vim

 Linux/Unix: Comes installed with practically all
  distributions

 OSX: Ships with Vim, but use MacVim for a GUI:
    http://code.google.com/p/macvim/

     Tip: Use iTerm2 for 256-color color schemes!

 Windows: Use gVim: http://www.vim.org/download.php#pc
Download vimfiles

 Download my configuration files to start

 If git is installed:
 > cd ~
 > git clone http://github.com/thenovices/dotfiles
 > ln –s dotfiles/.vim* .


 Otherwise, download zip from
  http://github.com/thenovices/dotfiles
What are we doing?

 Whirlwind tour of Vim‘s key features

 Come back and use this powerpoint as a reference

 Play around with me!




http://bit.ly/yfGl30
Vim Philosophy


1.Modal Editing
2.Operators and Motions
The Modal Editor

 We spend more time reading and editing than
  typing!

 Normal mode: All keystrokes are interpreted as
  commands

 Insert mode: Regular typing as you know it

 Visual mode: Highlighting

 … more!
Surviving in Vim




 i – Gets you into insertion mode
 <ESC> – Always gets you back to normal mode
 :wq<Enter> – Saves and quits Vim
Advanced movement

 Vim is all about saving keystrokes! Many many
  motion commands.


This is some text                       ^ – begin
                                        line
                                        beginning
^             b        e w      $       end
              cursor
                                        word
                                        $ – end line
Operator-Motion Model
Operators

 d – Delete
 c – Change (delete and go into insertion mode)
 y – Yank (Copy)
 v – Visual/Highlight

 Combine with motions to great effect! Type an
  operator twice to act upon the entire line.
More Common
             Commands
 V – Visual line highlighting
 o – Create new line below and go into insertion
   mode

 x – Delete character under cursor
R – Go into replacement mode (try it!)
u – Undo (very helpful )
A – Append to end of line (goes into insertion mode)
Text Objects

 w – word (delimited by punctuation)
 W – word (delimited by whitespace)
 ) – matching set of parentheses (also [], {}, <>, ‗‘, ―‖)
t – XML tag (e.g. <html></html>)
Putting it all together
Find and Replace

 / – Searches in the document for some string
 n – Goes to next occurrence
 N – Goes to previous occurrence
 :%s/foo/bar             – replace all occurrences of ‗foo‘
   with ‗bar‘ in the entire document. (Key token: ‗%‘)

 You can use regular expressions as well!
What now?

 Once you‘ve mastered the basics, gradually pick up
  more and more Vim tricks.

 Learn one thing at a time

 Explore Vim plugins.
Demonstration!
Advanced Topics

 Windows

 Tabs

 Buffers

 Macros

 Marks

 Visual Blocks
Popular Plugins

 Surround.vim

 Fugitive.vim (Git integration)

 Rails.vim (Rails integration)

 NERD_tree.vim (File Explorer)

 Tabular.vim (Alignment, tables)

 Snipmate.vim (Textmate-like snippets)
Resources and Links

 vimtutor (30-minutes) and :help usr_02.txt (manual)

 Learn Vim Progressively (good way to start off)
     http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/


 Treasure Trove of Vim Tricks:
     http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-
     vim/1220118#1220118


 Why do those nutheads use Vim? (like a showcase)
     http://www.viemu.com/a-why-vi-vim.html


 Comprehensive list of Vim tips and tricks (advanced!!)
     http://rayninfo.co.uk/vimtips.html


 Brandon‘s dotfiles: http://github.com/thenovices/dotfiles
More Advanced Links

 http://vimcasts.org

 https://github.com/tpope/tpope

 https://github.com/ryanb/dotfiles

 https://github.com/languages/VimL

More Related Content

What's hot

Basic command ppt
Basic command pptBasic command ppt
Basic command pptRohit Kumar
 
50 most frequently used unix linux commands (with examples)
50 most frequently used unix   linux commands (with examples)50 most frequently used unix   linux commands (with examples)
50 most frequently used unix linux commands (with examples)Rodrigo Maia
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examplesabclearnn
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Wave Digitech
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commandsMohammad Rafiee
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux Harish R
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell scriptBhavesh Padharia
 
A Quick Introduction to Linux
A Quick Introduction to LinuxA Quick Introduction to Linux
A Quick Introduction to LinuxTusharadri Sarkar
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell ScriptingRaghu nath
 
Presentation of awk
Presentation of awkPresentation of awk
Presentation of awkyogesh4589
 
Linux Administration
Linux AdministrationLinux Administration
Linux AdministrationHarish1983
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic CommandsHanan Nmr
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scriptingVIKAS TIWARI
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programmingsudhir singh yadav
 
Basic Linux Security
Basic Linux SecurityBasic Linux Security
Basic Linux Securitypankaj009
 

What's hot (20)

Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
 
50 most frequently used unix linux commands (with examples)
50 most frequently used unix   linux commands (with examples)50 most frequently used unix   linux commands (with examples)
50 most frequently used unix linux commands (with examples)
 
Linux basic commands with examples
Linux basic commands with examplesLinux basic commands with examples
Linux basic commands with examples
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commands
 
Introduction to Linux
Introduction to Linux Introduction to Linux
Introduction to Linux
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 
A Quick Introduction to Linux
A Quick Introduction to LinuxA Quick Introduction to Linux
A Quick Introduction to Linux
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Presentation of awk
Presentation of awkPresentation of awk
Presentation of awk
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Shell programming
Shell programmingShell programming
Shell programming
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
Linux fundamentals
Linux fundamentalsLinux fundamentals
Linux fundamentals
 
Basic Linux Security
Basic Linux SecurityBasic Linux Security
Basic Linux Security
 
Users and groups
Users and groupsUsers and groups
Users and groups
 
Linux commands
Linux commandsLinux commands
Linux commands
 

Viewers also liked

Project on vim bar
Project on vim barProject on vim bar
Project on vim barshirshendu
 
Introduction to Vim, the text editor
Introduction to Vim, the text editorIntroduction to Vim, the text editor
Introduction to Vim, the text editorVysakh Sreenivasan
 
How to become a practical Vim user
How to become a practical Vim userHow to become a practical Vim user
How to become a practical Vim userKana Natsuno
 
How To Access Code In Large w/ Vim
How To Access Code In Large w/ VimHow To Access Code In Large w/ Vim
How To Access Code In Large w/ VimCheng Hsien Chen
 
Vim, the Way of the Keyboard
Vim, the Way of the KeyboardVim, the Way of the Keyboard
Vim, the Way of the KeyboardFederico Galassi
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPTQUONTRASOLUTIONS
 
Linux process management
Linux process managementLinux process management
Linux process managementRaghu nath
 
BBA Internship Report on Brand Building & Sustainable Development of Unilever...
BBA Internship Report on Brand Building & Sustainable Development of Unilever...BBA Internship Report on Brand Building & Sustainable Development of Unilever...
BBA Internship Report on Brand Building & Sustainable Development of Unilever...Md. Abdur Rakib
 
Dishwasher
DishwasherDishwasher
DishwasherRoger97
 
Market segmentation of IFB commercial dishwasher
Market segmentation of IFB commercial dishwasher Market segmentation of IFB commercial dishwasher
Market segmentation of IFB commercial dishwasher Nahid Anjum
 

Viewers also liked (20)

Vimbar
VimbarVimbar
Vimbar
 
Project on vim bar
Project on vim barProject on vim bar
Project on vim bar
 
Vim Hacks
Vim HacksVim Hacks
Vim Hacks
 
Vim survival guide
Vim survival guideVim survival guide
Vim survival guide
 
Dettol Dish Washer
Dettol Dish WasherDettol Dish Washer
Dettol Dish Washer
 
Vim Rocks!
Vim Rocks!Vim Rocks!
Vim Rocks!
 
Vim Showcase
Vim ShowcaseVim Showcase
Vim Showcase
 
Introduction to Vim, the text editor
Introduction to Vim, the text editorIntroduction to Vim, the text editor
Introduction to Vim, the text editor
 
Vim
VimVim
Vim
 
How to become a practical Vim user
How to become a practical Vim userHow to become a practical Vim user
How to become a practical Vim user
 
How To Access Code In Large w/ Vim
How To Access Code In Large w/ VimHow To Access Code In Large w/ Vim
How To Access Code In Large w/ Vim
 
TMUX Rocks!
TMUX Rocks!TMUX Rocks!
TMUX Rocks!
 
Vim, the Way of the Keyboard
Vim, the Way of the KeyboardVim, the Way of the Keyboard
Vim, the Way of the Keyboard
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPT
 
Power poin perswnt
Power poin perswntPower poin perswnt
Power poin perswnt
 
vim - Tips and_tricks
vim - Tips and_tricksvim - Tips and_tricks
vim - Tips and_tricks
 
Linux process management
Linux process managementLinux process management
Linux process management
 
BBA Internship Report on Brand Building & Sustainable Development of Unilever...
BBA Internship Report on Brand Building & Sustainable Development of Unilever...BBA Internship Report on Brand Building & Sustainable Development of Unilever...
BBA Internship Report on Brand Building & Sustainable Development of Unilever...
 
Dishwasher
DishwasherDishwasher
Dishwasher
 
Market segmentation of IFB commercial dishwasher
Market segmentation of IFB commercial dishwasher Market segmentation of IFB commercial dishwasher
Market segmentation of IFB commercial dishwasher
 

Similar to Introduction to Vim

Similar to Introduction to Vim (20)

Augusta Linux User Group - Vim Introduction
Augusta Linux User Group - Vim IntroductionAugusta Linux User Group - Vim Introduction
Augusta Linux User Group - Vim Introduction
 
What is Vim?
What is Vim?What is Vim?
What is Vim?
 
Unit 5 vim an advanced text editor
Unit 5 vim an advanced text editorUnit 5 vim an advanced text editor
Unit 5 vim an advanced text editor
 
Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vim
 
Vim Vi Improved
Vim Vi ImprovedVim Vi Improved
Vim Vi Improved
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentation
 
Vi
ViVi
Vi
 
unix-editors.pdf
unix-editors.pdfunix-editors.pdf
unix-editors.pdf
 
Vi editor in linux
Vi editor in linuxVi editor in linux
Vi editor in linux
 
Emacs tutorial
Emacs tutorialEmacs tutorial
Emacs tutorial
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
 
Vim Hacks
Vim HacksVim Hacks
Vim Hacks
 
Vim Editor And Basic Scripting (Ch-7)
Vim Editor And Basic Scripting (Ch-7)Vim Editor And Basic Scripting (Ch-7)
Vim Editor And Basic Scripting (Ch-7)
 
Vim FTW!
Vim FTW!Vim FTW!
Vim FTW!
 
Vim - How to Develop Like a Ninja
Vim - How to Develop Like a NinjaVim - How to Develop Like a Ninja
Vim - How to Develop Like a Ninja
 
andrew's guide to vim
andrew's guide to vimandrew's guide to vim
andrew's guide to vim
 
Text editor In RHEL
Text editor In RHELText editor In RHEL
Text editor In RHEL
 
swl--3 (1).docx
swl--3 (1).docxswl--3 (1).docx
swl--3 (1).docx
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 
Linuxppt
LinuxpptLinuxppt
Linuxppt
 

Recently uploaded

Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 

Recently uploaded (20)

Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 

Introduction to Vim

  • 1.
  • 2. What is Vim?  Advanced programmer‘s text editor  Designed expressly for efficient text editing  IDE-like features not built-in, but 1000‘s of plugins  Highly customizable and extensible  Incredibly powerful—will double or triple your productivity!  Steep learning curve—takes years to master
  • 3.
  • 4. Installing Vim  Linux/Unix: Comes installed with practically all distributions  OSX: Ships with Vim, but use MacVim for a GUI: http://code.google.com/p/macvim/  Tip: Use iTerm2 for 256-color color schemes!  Windows: Use gVim: http://www.vim.org/download.php#pc
  • 5. Download vimfiles  Download my configuration files to start  If git is installed: > cd ~ > git clone http://github.com/thenovices/dotfiles > ln –s dotfiles/.vim* .  Otherwise, download zip from http://github.com/thenovices/dotfiles
  • 6. What are we doing?  Whirlwind tour of Vim‘s key features  Come back and use this powerpoint as a reference  Play around with me! http://bit.ly/yfGl30
  • 8. The Modal Editor  We spend more time reading and editing than typing!  Normal mode: All keystrokes are interpreted as commands  Insert mode: Regular typing as you know it  Visual mode: Highlighting  … more!
  • 9. Surviving in Vim  i – Gets you into insertion mode  <ESC> – Always gets you back to normal mode  :wq<Enter> – Saves and quits Vim
  • 10. Advanced movement  Vim is all about saving keystrokes! Many many motion commands. This is some text ^ – begin line beginning ^ b e w $ end cursor word $ – end line
  • 12. Operators  d – Delete  c – Change (delete and go into insertion mode)  y – Yank (Copy)  v – Visual/Highlight  Combine with motions to great effect! Type an operator twice to act upon the entire line.
  • 13. More Common Commands  V – Visual line highlighting  o – Create new line below and go into insertion mode  x – Delete character under cursor R – Go into replacement mode (try it!) u – Undo (very helpful ) A – Append to end of line (goes into insertion mode)
  • 14. Text Objects  w – word (delimited by punctuation)  W – word (delimited by whitespace)  ) – matching set of parentheses (also [], {}, <>, ‗‘, ―‖) t – XML tag (e.g. <html></html>)
  • 15. Putting it all together
  • 16. Find and Replace  / – Searches in the document for some string  n – Goes to next occurrence  N – Goes to previous occurrence  :%s/foo/bar – replace all occurrences of ‗foo‘ with ‗bar‘ in the entire document. (Key token: ‗%‘)  You can use regular expressions as well!
  • 17. What now?  Once you‘ve mastered the basics, gradually pick up more and more Vim tricks.  Learn one thing at a time  Explore Vim plugins.
  • 19. Advanced Topics  Windows  Tabs  Buffers  Macros  Marks  Visual Blocks
  • 20. Popular Plugins  Surround.vim  Fugitive.vim (Git integration)  Rails.vim (Rails integration)  NERD_tree.vim (File Explorer)  Tabular.vim (Alignment, tables)  Snipmate.vim (Textmate-like snippets)
  • 21. Resources and Links  vimtutor (30-minutes) and :help usr_02.txt (manual)  Learn Vim Progressively (good way to start off) http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/  Treasure Trove of Vim Tricks: http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with- vim/1220118#1220118  Why do those nutheads use Vim? (like a showcase) http://www.viemu.com/a-why-vi-vim.html  Comprehensive list of Vim tips and tricks (advanced!!) http://rayninfo.co.uk/vimtips.html  Brandon‘s dotfiles: http://github.com/thenovices/dotfiles
  • 22. More Advanced Links  http://vimcasts.org  https://github.com/tpope/tpope  https://github.com/ryanb/dotfiles  https://github.com/languages/VimL

Editor's Notes

  1. When you think about it, we spend much more time reading and editing text than actually typing in text. But when we have to read and edit text, we end up having to use the mouse, or buttons or keyboard shortcuts. Why should the insertion mode be the default mode?In Vim, keys are interpreted differently depending on what mode you’re in. In insertion mode, typing ‘j’ types out ‘j’, but in normal mode, typing ‘j’ makes you go down a line.