SlideShare a Scribd company logo
VIM For The PHP Developer
    Anything you can do, I can do faster.
VIM for the PHP Developer
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

More Related Content

Similar to VIM for the PHP Developer (20)

PDF
Mission vim possible-full
Sam Gottfried
 
PDF
Tuffarsi in vim
sambismo
 
PDF
Vi reference
aireddy
 
PDF
Vi reference
SurenderAireddy
 
PDF
VIM for Programmers
Akash Agrawal
 
PDF
Vim For Php
Liu Lizhi
 
PDF
Rubizza #1 | Special Lecture. Vim
Rubizza
 
ODP
Vim and Python
majmcdonald
 
PDF
Vi Editor
Shiwang Kalkhanda
 
PDF
Vim
Eddie Kao
 
PDF
Vim Cheat Sheet.pdf
AdelinaBronda1
 
PDF
Using VI Editor in Red Hat by Rohit Kumar
Rohit Kumar
 
PDF
Using vi editor
Rohit Kumar
 
PDF
Linux text editors
InfoExcavator
 
PDF
Linux text editors Vim nano
Md Meherab Hossen
 
KEY
Vim Cards - Keynote Format
Adam Lowe
 
PPTX
Presentacion vim
Icalia Labs
 
DOC
Qc document draft
gourabehera
 
PPT
Vim Vi Improved
Tusharadri Sarkar
 
ODP
Vim
Anuj Jain
 
Mission vim possible-full
Sam Gottfried
 
Tuffarsi in vim
sambismo
 
Vi reference
aireddy
 
Vi reference
SurenderAireddy
 
VIM for Programmers
Akash Agrawal
 
Vim For Php
Liu Lizhi
 
Rubizza #1 | Special Lecture. Vim
Rubizza
 
Vim and Python
majmcdonald
 
Vim Cheat Sheet.pdf
AdelinaBronda1
 
Using VI Editor in Red Hat by Rohit Kumar
Rohit Kumar
 
Using vi editor
Rohit Kumar
 
Linux text editors
InfoExcavator
 
Linux text editors Vim nano
Md Meherab Hossen
 
Vim Cards - Keynote Format
Adam Lowe
 
Presentacion vim
Icalia Labs
 
Qc document draft
gourabehera
 
Vim Vi Improved
Tusharadri Sarkar
 

Recently uploaded (20)

PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
Edge AI and Vision Alliance
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
PDF
Home Cleaning App Development Services.pdf
V3cube
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
PDF
Survival Models: Proper Scoring Rule and Stochastic Optimization with Competi...
Paris Women in Machine Learning and Data Science
 
PDF
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
PPTX
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
PPTX
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Linux schedulers for fun and profit with SchedKit
Alessio Biancalana
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
“ONNX and Python to C++: State-of-the-art Graph Compilation,” a Presentation ...
Edge AI and Vision Alliance
 
Digital Circuits, important subject in CS
contactparinay1
 
Role_of_Artificial_Intelligence_in_Livestock_Extension_Services.pptx
DrRajdeepMadavi
 
Home Cleaning App Development Services.pdf
V3cube
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Manual Testing for Accessibility Enhancement
Julia Undeutsch
 
Survival Models: Proper Scoring Rule and Stochastic Optimization with Competi...
Paris Women in Machine Learning and Data Science
 
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pdf
ghjghvhjgc
 
CapCut Pro PC Crack Latest Version Free Free
josanj305
 
Securing Model Context Protocol with Keycloak: AuthN/AuthZ for MCP Servers
Hitachi, Ltd. OSS Solution Center.
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Bitkom eIDAS Summit | European Business Wallet: Use Cases, Macroeconomics, an...
Carsten Stoecker
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Linux schedulers for fun and profit with SchedKit
Alessio Biancalana
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Modern Decentralized Application Architectures.pdf
Kalema Edgar
 
Ad

VIM for the PHP Developer

  • 1. VIM For The PHP Developer Anything you can do, I can do faster.
  • 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

Editor's Notes