VIM for the PHP Developer

2,212 views

Published on

A beginners look into using VIM for PHP developers. Showing the basic commands and some more advanced ones too.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,212
On SlideShare
0
From Embeds
0
Number of Embeds
62
Actions
Shares
0
Downloads
21
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • VIM for the PHP Developer

    1. 1. VIM For The PHP Developer Anything you can do, I can do faster.
    2. 2. WHY VIM?
    3. 3. WHY VIM? SimpleServer/Remote
    4. 4. WHY VIM? Simple Development SpeedServer/Remote
    5. 5. WHY VIM? Simple Development SpeedServer/RemoteCross Platform
    6. 6. WHY VIM? Simple Development SpeedServer/Remote Same EnvironmentCross Platform Everywhere
    7. 7. VIM MODESNormal Insert Bottom Line
    8. 8. VIM MODESNormal Insert Bottom LineShould be used mostof the time. Movearound document,cut/copy/paste,search/replace, etc...
    9. 9. VIM MODESNormal Insert Bottom LineShould be used most Typing mode, used toof the time. Move enter new text.around document, Noobs spend toocut/copy/paste, much time here.search/replace, etc...
    10. 10. VIM MODESNormal Insert Bottom LineShould be used most Typing mode, used to Used to change theof 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...
    11. 11. SIMPLEST EDITINGvi <filename>i - go into insert modeedit text<esc> - exit insert mode:x,:wq - save and exit
    12. 12. SIMPLEST EDITINGvi <filename>i - go into insert modeedit text<esc> - exit insert mode:x,:wq - save and exit
    13. 13. MOVING AROUND A DOCUMENT
    14. 14. MOVING AROUND A DOCUMENTh,j,k,l = left, up, down, right
    15. 15. MOVING AROUND A DOCUMENTh,j,k,l = left, up, down, rightw,b = forward/backward one word
    16. 16. MOVING AROUND A DOCUMENTh,j,k,l = left, up, down, rightw,b = forward/backward one word0,$ = beginning/end of line
    17. 17. MOVING AROUND A DOCUMENTh,j,k,l = left, up, down, rightw,b = forward/backward one word0,$ = beginning/end of line(,) = beginning / end of sentence
    18. 18. MOVING AROUND A DOCUMENTh,j,k,l = left, up, down, rightw,b = forward/backward one word0,$ = beginning/end of line(,) = beginning / end of sentence{,} = beginning / end of paragraph
    19. 19. MOVING AROUND A DOCUMENTh,j,k,l = left, up, down, rightw,b = forward/backward one word0,$ = beginning/end of line(,) = beginning / end of sentence{,} = beginning / end of paragraphG = end of file (1G goes to top, nG goes to line n)
    20. 20. MOVING AROUND A DOCUMENTh,j,k,l = left, up, down, rightw,b = forward/backward one word0,$ = beginning/end of line(,) = beginning / end of sentence{,} = beginning / end of paragraphG = end of file (1G goes to top, nG goes to line n)% = go to matching bracket
    21. 21. MOVING AROUND A DOCUMENTh,j,k,l = left, up, down, rightw,b = forward/backward one word0,$ = beginning/end of line(,) = beginning / end of sentence{,} = beginning / end of paragraphG = end of file (1G goes to top, nG goes to line n)% = go to matching bracketzt,zz,zb = move current line to top/center/bottom of viewport
    22. 22. ENTERING INSERT MODE
    23. 23. ENTERING INSERT MODEi,a = insert text before/after cursor
    24. 24. ENTERING INSERT MODEi,a = insert text before/after cursorI,A = insert text at the beginning/end of line
    25. 25. ENTERING INSERT MODEi,a = insert text before/after cursorI,A = insert text at the beginning/end of lineo,O = open a new line after/before current one
    26. 26. SEARCH AND REPLACE
    27. 27. SEARCH AND REPLACE/string, ?string = search for string forwards / backwards
    28. 28. SEARCH AND REPLACE/string, ?string = search for string forwards / backwardsn,N = find next/previous occurrence
    29. 29. SEARCH AND REPLACE/string, ?string = search for string forwards / backwardsn,N = find next/previous occurrence:%s/find/replace/[ g | i |c ] =
    30. 30. SEARCH AND REPLACE/string, ?string = search for string forwards / backwardsn,N = find next/previous occurrence:%s/find/replace/[ g | i |c ] = g=all occurrences on a line
    31. 31. SEARCH AND REPLACE/string, ?string = search for string forwards / backwardsn,N = find next/previous occurrence:%s/find/replace/[ g | i |c ] = g=all occurrences on a line i=case insensitive
    32. 32. SEARCH AND REPLACE/string, ?string = search for string forwards / backwardsn,N = find next/previous occurrence:%s/find/replace/[ g | i |c ] = g=all occurrences on a line i=case insensitive c=confirm
    33. 33. SEARCH AND REPLACE/string, ?string = search for string forwards / backwardsn,N = find next/previous occurrence:%s/find/replace/[ g | i |c ] = g=all occurrences on a line i=case insensitive c=confirmctrl-a, ctrl-x = increment/decrement next number on line
    34. 34. SEARCH AND REPLACE/string, ?string = search for string forwards / backwardsn,N = find next/previous occurrence:%s/find/replace/[ g | i |c ] = g=all occurrences on a line i=case insensitive c=confirmctrl-a, ctrl-x = increment/decrement next number on line:bufdo /search/ = search all open buffers
    35. 35. EDITING TEXTx = delete single character w = wordd = delete (cut) dw = delete wordy = yank (copy) yw = yank wordp,P = paste after/before examplesu = undo dd, yy, <n>dd, <n>yyJ = join lines, current and next line <n>p, <n>u<,> = reduce, increase indentation d$, yG, <n>cc, <n>cw, c$. = repeat last commandc = change
    36. 36. BUFFERS
    37. 37. BUFFERSThe contents of a file are loaded into memory (buffer)
    38. 38. BUFFERSThe 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
    39. 39. WINDOWS:hsplit,:vsplit = split horizonal/verticalctrl-w = start a window command (cw)cw<hjkl> = move left,up,down,right one windowcwcw = cycle windowscw_ = maximize current windowcw= = make all windows equal size10cw+ = increase window by 10 lines (- would decrease):only = make this the only window
    40. 40. 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
    41. 41. MARKERSm<a-z> = set mark, labeled a-z‘<a-z> = go to markd’<a-z> = delete from here to marky’<a-z> = yank from here to mark
    42. 42. CONFIGURATIONMainly ~/.vimrcDirectories ~/.vim/plugin ~/.vim/syntax ~/.vim/autoloadUsed to define your environment
    43. 43. 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
    44. 44. PLUGINSvim.org - currently over 4,000 pluginsNERDtreephpcompletespf13-vim
    45. 45. THEMESTons built in:colorscheme <tab>
    46. 46. SELFISH PLUGHeadNorth helps local people from San Diego with Spinal Cord InjuriesSpinal Cord Injuries are crippling, HeadNorth tries to help in the transitionThey go far beyond, and help with chairs, even remodeling homes.Donate HereLong version: www.kintera.org/faf/r.asp?t=4&i=1035746&u=1035746-369694704www.headnorthevents.org
    47. 47. THANK YOU!Please rate my talk (GOOD & BAD) https://joind.in/event/view/1105Try vimtutor, vimdiff, mvimdiff

    ×