SlideShare une entreprise Scribd logo
1  sur  48
VIM For The PHP Developer
    Anything you can do, I can do faster.
WHY VIM?
WHY VIM?

    Simple
Server/Remote
WHY VIM?

    Simple
                       Development Speed
Server/Remote
WHY VIM?

    Simple
                        Development Speed
Server/Remote



Cross Platform
WHY VIM?

    Simple
                        Development Speed
Server/Remote



                        Same Environment
Cross Platform
                           Everywhere
VIM MODES
Normal   Insert      Bottom Line
VIM MODES
Normal                   Insert      Bottom Line

Should be used most
of the time. Move
around document,
cut/copy/paste,
search/replace, etc...
VIM MODES
Normal                   Insert                 Bottom Line

Should be used most      Typing mode, used to
of the time. Move        enter new text.
around document,         Noobs spend too
cut/copy/paste,          much time here.
search/replace, etc...
VIM MODES
Normal                   Insert                 Bottom Line

Should be used most      Typing mode, used to   Used to change the
of the time. Move        enter new text.        vim environment,
around document,         Noobs spend too        open/close buffers,
cut/copy/paste,          much time here.        and so much more.
search/replace, etc...
SIMPLEST EDITING


vi <filename>

i - go into insert mode

edit text

<esc> - exit insert mode

:x,:wq - save and exit
SIMPLEST EDITING


vi <filename>

i - go into insert mode

edit text

<esc> - exit insert mode

:x,:wq - save and exit
MOVING AROUND A DOCUMENT
MOVING AROUND A DOCUMENT

h,j,k,l = left, up, down, right
MOVING AROUND A DOCUMENT

h,j,k,l = left, up, down, right
w,b = forward/backward one word
MOVING AROUND A DOCUMENT

h,j,k,l = left, up, down, right
w,b = forward/backward one word
0,$ = beginning/end of line
MOVING AROUND A DOCUMENT

h,j,k,l = left, up, down, right
w,b = forward/backward one word
0,$ = beginning/end of line
(,) = beginning / end of sentence
MOVING AROUND A DOCUMENT

h,j,k,l = left, up, down, right
w,b = forward/backward one word
0,$ = beginning/end of line
(,) = beginning / end of sentence
{,} = beginning / end of paragraph
MOVING AROUND A DOCUMENT

h,j,k,l = left, up, down, right
w,b = forward/backward one word
0,$ = beginning/end of line
(,) = beginning / end of sentence
{,} = beginning / end of paragraph
G = end of file (1G goes to top, nG goes to line n)
MOVING AROUND A DOCUMENT

h,j,k,l = left, up, down, right
w,b = forward/backward one word
0,$ = beginning/end of line
(,) = beginning / end of sentence
{,} = beginning / end of paragraph
G = end of file (1G goes to top, nG goes to line n)
% = go to matching bracket
MOVING AROUND A DOCUMENT

h,j,k,l = left, up, down, right
w,b = forward/backward one word
0,$ = beginning/end of line
(,) = beginning / end of sentence
{,} = beginning / end of paragraph
G = end of file (1G goes to top, nG goes to line n)
% = go to matching bracket
zt,zz,zb = move current line to top/center/bottom of viewport
ENTERING INSERT MODE
ENTERING INSERT MODE



i,a = insert text before/after cursor
ENTERING INSERT MODE



i,a = insert text before/after cursor

I,A = insert text at the beginning/end of line
ENTERING INSERT MODE



i,a = insert text before/after cursor

I,A = insert text at the beginning/end of line

o,O = open a new line after/before current one
SEARCH AND REPLACE
SEARCH AND REPLACE

/string, ?string = search for string forwards / backwards
SEARCH AND REPLACE

/string, ?string = search for string forwards / backwards
n,N = find next/previous occurrence
SEARCH AND REPLACE

/string, ?string = search for string forwards / backwards
n,N = find next/previous occurrence
:%s/find/replace/[ g | i |c ] =
SEARCH AND REPLACE

/string, ?string = search for string forwards / backwards
n,N = find next/previous occurrence
:%s/find/replace/[ g | i |c ] =
  g=all occurrences on a line
SEARCH AND REPLACE

/string, ?string = search for string forwards / backwards
n,N = find next/previous occurrence
:%s/find/replace/[ g | i |c ] =
  g=all occurrences on a line
  i=case insensitive
SEARCH AND REPLACE

/string, ?string = search for string forwards / backwards
n,N = find next/previous occurrence
:%s/find/replace/[ g | i |c ] =
  g=all occurrences on a line
  i=case insensitive
  c=confirm
SEARCH AND REPLACE

/string, ?string = search for string forwards / backwards
n,N = find next/previous occurrence
:%s/find/replace/[ g | i |c ] =
  g=all occurrences on a line
  i=case insensitive
  c=confirm
ctrl-a, ctrl-x = increment/decrement next number on line
SEARCH AND REPLACE

/string, ?string = search for string forwards / backwards
n,N = find next/previous occurrence
:%s/find/replace/[ g | i |c ] =
  g=all occurrences on a line
  i=case insensitive
  c=confirm
ctrl-a, ctrl-x = increment/decrement next number on line
:bufdo /search/ = search all open buffers
EDITING TEXT

x = delete single character             w = word
d = delete (cut)                          dw = delete word
y = yank (copy)                           yw = yank word
p,P = paste after/before                examples
u = undo                                  dd, yy, <n>dd, <n>yy
J = join lines, current and next line     <n>p, <n>u
<,> = reduce, increase indentation        d$, yG, <n>cc, <n>cw, c$
. = repeat last command
c = change
BUFFERS
BUFFERS
The contents of a file are loaded into memory (buffer)
BUFFERS
The contents of a file are loaded into memory (buffer)

:buffers, :ls = list buffers
:e <file> = edit/open a file into a new buffer
:bn, :bp = next/previous buffer
:bd = delete buffer
:buffer <n> = jump to buffer <n>
:sbuffer <file> = split buffer, open in another window
WINDOWS

:hsplit,:vsplit = split horizonal/vertical
ctrl-w = start a window command (cw)
cw<hjkl> = move left,up,down,right one window
cwcw = cycle windows
cw_ = maximize current window
cw= = make all windows equal size
10cw+ = increase window by 10 lines (- would decrease)
:only = make this the only window
TABS

:tabs = list all tabs
:tabnext = next tab
:tabdo %s/2.5.2/2.6.0/gc
:tabnew
:tabedit
:tabfirst
:tablast
:tabm <n> = move tab to position
MARKERS


m<a-z> = set mark, labeled a-z

‘<a-z> = go to mark

d’<a-z> = delete from here to mark

y’<a-z> = yank from here to mark
CONFIGURATION

Mainly ~/.vimrc
Directories
  ~/.vim/plugin
  ~/.vim/syntax
  ~/.vim/autoload
Used to define your environment
INDENTING COMMANDS


:set tabstop=4

:set shifttab=4

:set softtabstop=4

:set expandtab, :set noexpandtab

:retab = Change tabs to spaces and vice versa, depending on expandtab
PLUGINS



vim.org - currently over 4,000 plugins
NERDtree
phpcomplete
spf13-vim
THEMES

Tons built in

:colorscheme <tab>
SELFISH PLUG

HeadNorth helps local people from San Diego with Spinal Cord Injuries

Spinal Cord Injuries are crippling, HeadNorth tries to help in the transition

They go far beyond, and help with chairs, even remodeling homes.

Donate Here

Long version:
  www.kintera.org/faf/r.asp?t=4&i=1035746&u=1035746-369694704

www.headnorthevents.org
THANK YOU!



Please rate my talk (GOOD & BAD)

  https://joind.in/event/view/1105

Try vimtutor, vimdiff, mvimdiff

Contenu connexe

Similaire à VIM for the PHP Developer

Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.VimLin Yo-An
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaLin Yo-An
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchinaguestcf9240
 
Mission vim possible-full
Mission vim possible-fullMission vim possible-full
Mission vim possible-fullSam Gottfried
 
Rubizza #1 | Special Lecture. Vim
Rubizza #1 | Special Lecture. Vim Rubizza #1 | Special Lecture. Vim
Rubizza #1 | Special Lecture. Vim Rubizza
 
Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vimsambismo
 
Interface de Voz con Rails
Interface de Voz con RailsInterface de Voz con Rails
Interface de Voz con RailsSvet Ivantchev
 
Mission vim possible
Mission vim possibleMission vim possible
Mission vim possibleSam Gottfried
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basicsAbhay Sapru
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting BasicsDr.Ravi
 
Introduction to programming - class 3
Introduction to programming - class 3Introduction to programming - class 3
Introduction to programming - class 3Paul Brebner
 
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...Arc & Codementor
 

Similaire à VIM for the PHP Developer (20)

Perl.Hacks.On.Vim
Perl.Hacks.On.VimPerl.Hacks.On.Vim
Perl.Hacks.On.Vim
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchina
 
Perl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim PerlchinaPerl.Hacks.On.Vim Perlchina
Perl.Hacks.On.Vim Perlchina
 
Mission vim possible-full
Mission vim possible-fullMission vim possible-full
Mission vim possible-full
 
Vim Hacks
Vim HacksVim Hacks
Vim Hacks
 
Vim Hacks
Vim HacksVim Hacks
Vim Hacks
 
Rubizza #1 | Special Lecture. Vim
Rubizza #1 | Special Lecture. Vim Rubizza #1 | Special Lecture. Vim
Rubizza #1 | Special Lecture. Vim
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
 
Vim Cheat Sheet.pdf
Vim Cheat Sheet.pdfVim Cheat Sheet.pdf
Vim Cheat Sheet.pdf
 
Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vim
 
Interface de Voz con Rails
Interface de Voz con RailsInterface de Voz con Rails
Interface de Voz con Rails
 
Vim
VimVim
Vim
 
Mission vim possible
Mission vim possibleMission vim possible
Mission vim possible
 
Unix shell scripting basics
Unix shell scripting basicsUnix shell scripting basics
Unix shell scripting basics
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
 
Vim For Php
Vim For PhpVim For Php
Vim For Php
 
Introduction to programming - class 3
Introduction to programming - class 3Introduction to programming - class 3
Introduction to programming - class 3
 
vim - Tips and_tricks
vim - Tips and_tricksvim - Tips and_tricks
vim - Tips and_tricks
 
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
 
VIM for Programmers
VIM for ProgrammersVIM for Programmers
VIM for Programmers
 

Dernier

Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKUXDXConf
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxDavid Michel
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastUXDXConf
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyJohn Staveley
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Julian Hyde
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutesconfluent
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...CzechDreamin
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoTAnalytics
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyUXDXConf
 

Dernier (20)

Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 

VIM for the PHP Developer

  • 1. VIM For The PHP Developer Anything you can do, I can do faster.
  • 2.
  • 4. WHY VIM? Simple Server/Remote
  • 5. WHY VIM? Simple Development Speed Server/Remote
  • 6. WHY VIM? Simple Development Speed Server/Remote Cross Platform
  • 7. WHY VIM? Simple Development Speed Server/Remote Same Environment Cross Platform Everywhere
  • 8. VIM MODES Normal Insert Bottom Line
  • 9. VIM MODES Normal Insert Bottom Line Should be used most of the time. Move around document, cut/copy/paste, search/replace, etc...
  • 10. VIM MODES Normal Insert Bottom Line Should be used most Typing mode, used to of the time. Move enter new text. around document, Noobs spend too cut/copy/paste, much time here. search/replace, etc...
  • 11. VIM MODES Normal Insert Bottom Line Should be used most Typing mode, used to Used to change the of the time. Move enter new text. vim environment, around document, Noobs spend too open/close buffers, cut/copy/paste, much time here. and so much more. search/replace, etc...
  • 12. SIMPLEST EDITING vi <filename> i - go into insert mode edit text <esc> - exit insert mode :x,:wq - save and exit
  • 13. SIMPLEST EDITING vi <filename> i - go into insert mode edit text <esc> - exit insert mode :x,:wq - save and exit
  • 14. MOVING AROUND A DOCUMENT
  • 15. MOVING AROUND A DOCUMENT h,j,k,l = left, up, down, right
  • 16. MOVING AROUND A DOCUMENT h,j,k,l = left, up, down, right w,b = forward/backward one word
  • 17. MOVING AROUND A DOCUMENT h,j,k,l = left, up, down, right w,b = forward/backward one word 0,$ = beginning/end of line
  • 18. MOVING AROUND A DOCUMENT h,j,k,l = left, up, down, right w,b = forward/backward one word 0,$ = beginning/end of line (,) = beginning / end of sentence
  • 19. MOVING AROUND A DOCUMENT h,j,k,l = left, up, down, right w,b = forward/backward one word 0,$ = beginning/end of line (,) = beginning / end of sentence {,} = beginning / end of paragraph
  • 20. MOVING AROUND A DOCUMENT h,j,k,l = left, up, down, right w,b = forward/backward one word 0,$ = beginning/end of line (,) = beginning / end of sentence {,} = beginning / end of paragraph G = end of file (1G goes to top, nG goes to line n)
  • 21. MOVING AROUND A DOCUMENT h,j,k,l = left, up, down, right w,b = forward/backward one word 0,$ = beginning/end of line (,) = beginning / end of sentence {,} = beginning / end of paragraph G = end of file (1G goes to top, nG goes to line n) % = go to matching bracket
  • 22. MOVING AROUND A DOCUMENT h,j,k,l = left, up, down, right w,b = forward/backward one word 0,$ = beginning/end of line (,) = beginning / end of sentence {,} = beginning / end of paragraph G = end of file (1G goes to top, nG goes to line n) % = go to matching bracket zt,zz,zb = move current line to top/center/bottom of viewport
  • 24. ENTERING INSERT MODE i,a = insert text before/after cursor
  • 25. ENTERING INSERT MODE i,a = insert text before/after cursor I,A = insert text at the beginning/end of line
  • 26. ENTERING INSERT MODE i,a = insert text before/after cursor I,A = insert text at the beginning/end of line o,O = open a new line after/before current one
  • 28. SEARCH AND REPLACE /string, ?string = search for string forwards / backwards
  • 29. SEARCH AND REPLACE /string, ?string = search for string forwards / backwards n,N = find next/previous occurrence
  • 30. SEARCH AND REPLACE /string, ?string = search for string forwards / backwards n,N = find next/previous occurrence :%s/find/replace/[ g | i |c ] =
  • 31. SEARCH AND REPLACE /string, ?string = search for string forwards / backwards n,N = find next/previous occurrence :%s/find/replace/[ g | i |c ] = g=all occurrences on a line
  • 32. SEARCH AND REPLACE /string, ?string = search for string forwards / backwards n,N = find next/previous occurrence :%s/find/replace/[ g | i |c ] = g=all occurrences on a line i=case insensitive
  • 33. SEARCH AND REPLACE /string, ?string = search for string forwards / backwards n,N = find next/previous occurrence :%s/find/replace/[ g | i |c ] = g=all occurrences on a line i=case insensitive c=confirm
  • 34. SEARCH AND REPLACE /string, ?string = search for string forwards / backwards n,N = find next/previous occurrence :%s/find/replace/[ g | i |c ] = g=all occurrences on a line i=case insensitive c=confirm ctrl-a, ctrl-x = increment/decrement next number on line
  • 35. SEARCH AND REPLACE /string, ?string = search for string forwards / backwards n,N = find next/previous occurrence :%s/find/replace/[ g | i |c ] = g=all occurrences on a line i=case insensitive c=confirm ctrl-a, ctrl-x = increment/decrement next number on line :bufdo /search/ = search all open buffers
  • 36. EDITING TEXT x = delete single character w = word d = delete (cut) dw = delete word y = yank (copy) yw = yank word p,P = paste after/before examples u = undo dd, yy, <n>dd, <n>yy J = join lines, current and next line <n>p, <n>u <,> = reduce, increase indentation d$, yG, <n>cc, <n>cw, c$ . = repeat last command c = change
  • 38. BUFFERS The contents of a file are loaded into memory (buffer)
  • 39. BUFFERS The contents of a file are loaded into memory (buffer) :buffers, :ls = list buffers :e <file> = edit/open a file into a new buffer :bn, :bp = next/previous buffer :bd = delete buffer :buffer <n> = jump to buffer <n> :sbuffer <file> = split buffer, open in another window
  • 40. WINDOWS :hsplit,:vsplit = split horizonal/vertical ctrl-w = start a window command (cw) cw<hjkl> = move left,up,down,right one window cwcw = cycle windows cw_ = maximize current window cw= = make all windows equal size 10cw+ = increase window by 10 lines (- would decrease) :only = make this the only window
  • 41. TABS :tabs = list all tabs :tabnext = next tab :tabdo %s/2.5.2/2.6.0/gc :tabnew :tabedit :tabfirst :tablast :tabm <n> = move tab to position
  • 42. MARKERS m<a-z> = set mark, labeled a-z ‘<a-z> = go to mark d’<a-z> = delete from here to mark y’<a-z> = yank from here to mark
  • 43. CONFIGURATION Mainly ~/.vimrc Directories ~/.vim/plugin ~/.vim/syntax ~/.vim/autoload Used to define your environment
  • 44. INDENTING COMMANDS :set tabstop=4 :set shifttab=4 :set softtabstop=4 :set expandtab, :set noexpandtab :retab = Change tabs to spaces and vice versa, depending on expandtab
  • 45. PLUGINS vim.org - currently over 4,000 plugins NERDtree phpcomplete spf13-vim
  • 47. SELFISH PLUG HeadNorth helps local people from San Diego with Spinal Cord Injuries Spinal Cord Injuries are crippling, HeadNorth tries to help in the transition They go far beyond, and help with chairs, even remodeling homes. Donate Here Long version: www.kintera.org/faf/r.asp?t=4&i=1035746&u=1035746-369694704 www.headnorthevents.org
  • 48. THANK YOU! Please rate my talk (GOOD & BAD) https://joind.in/event/view/1105 Try vimtutor, vimdiff, mvimdiff

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n