Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Vim สั่งได้ดั่งใจ #bcbk4

2,752 views

Published on

Published in: Technology, Business

Vim สั่งได้ดั่งใจ #bcbk4

  1. 1. Advanced Vim Tips / Technique / Shortcuts Settings / Scripts 2013-09-22 Thai Pangsakulyanont @ BarCamp Bangkhen 4 Sunday, September 22, 13
  2. 2. Me • Thai Pangsakulyanont • Software and Knowledge Engineering Undergraduate Student, Kasetsart University • @dtinth • http://dt.in.th/ Sunday, September 22, 13
  3. 3. • http://bit.ly/bcbk4vim Sunday, September 22, 13
  4. 4. Outline • A Quick Demonstration • Built-In Features • Shortcut, Tips & Trick, Settings • Vundle • Plugins • More Resources Sunday, September 22, 13
  5. 5. A Quick Demonstration! Sunday, September 22, 13
  6. 6. .vimrc Settings Sunday, September 22, 13
  7. 7. Most Important Don’t stay in INSERT mode Sunday, September 22, 13
  8. 8. Disable Arrow Keys in Insert Mode • inoremap <Up> <NOP> • inoremap <Down> <NOP> • inoremap <Left> <NOP> • inoremap <Right> <NOP> Sunday, September 22, 13
  9. 9. & --NORMAL-- o O • Begin a new line (below/above) the cursor and insert text. Open Below Open Above Sunday, September 22, 13
  10. 10. & --NORMAL-- i a Insert Append Sunday, September 22, 13
  11. 11. & • Insert text before the first non-blank in the line. • Append text at the end of the line. --NORMAL-- I A INSERT APPEND Sunday, September 22, 13
  12. 12. --NORMAL-- • Search for pattern Search / Previous N Next n Sunday, September 22, 13
  13. 13. • Repeat last change --NORMAL-- . Repeat Sunday, September 22, 13
  14. 14. --NORMAL-- and --VISUAL-- J • Join multiple lines into 1 line. Join Sunday, September 22, 13
  15. 15. • Replace the character under the cursor without entering the insert mode. --NORMAL-- r Replace Sunday, September 22, 13
  16. 16. & • Add to the number. • Subtract from the number. --NORMAL-- ^a ^x Add Subtract Sunday, September 22, 13
  17. 17. Completion Sunday, September 22, 13
  18. 18. • Next match / previous match. • Keyword Completion. --INSERT-- &^n ^p Next Previous Sunday, September 22, 13
  19. 19. • File Name Completion. --INSERT-- ^x ^f ^f ^f Complete File (next) (next) Sunday, September 22, 13
  20. 20. • Omni Completion (context-sensitive). --INSERT-- ^x ^o ^o ^o Complete Omni (next) (next) Sunday, September 22, 13
  21. 21. Text Objects Sunday, September 22, 13
  22. 22. --NORMAL-- c d v Change Delete Visual Sunday, September 22, 13
  23. 23. iw aw i( a( i{ a{ i[ a[ i< a< i" a" i' a' it at Sunday, September 22, 13
  24. 24. "ic Change Inside " --NORMAL-- Sunday, September 22, 13
  25. 25. c Change A " "a --NORMAL-- Sunday, September 22, 13
  26. 26. In Visual Mode... Sunday, September 22, 13
  27. 27. --VISUAL-- c Change • Puts the deleted text into register. • So you can paste later. • Ex. Extract to Variable Sunday, September 22, 13
  28. 28. Visual·Line Mode Sunday, September 22, 13
  29. 29. V Visual (Linewise) --NORMAL-- Sunday, September 22, 13
  30. 30. --VISUAL·LINE-- < Outdent > Indent Sunday, September 22, 13
  31. 31. --VISUAL-- p Paste • Replaces the selected text. Sunday, September 22, 13
  32. 32. System Clipboard Register Sunday, September 22, 13
  33. 33. --NORMAL-- p Paste • Paste from Default (Internal) Register Sunday, September 22, 13
  34. 34. --NORMAL-- p Paste • Paste from System Clipboard + System Clipboard Select Register " Sunday, September 22, 13
  35. 35. More Shortcuts Sunday, September 22, 13
  36. 36. --INSERT-- ^h Remove Character ^w Remove Word h is the 8th letter of the English alphabet. ASCII code 8 is for “Backspace”. Sunday, September 22, 13
  37. 37. Vundle Sunday, September 22, 13
  38. 38. Vundle The Plugin Manager for Vim https://github.com/gmarik/vundle Sunday, September 22, 13
  39. 39. Vim Plugins Sunday, September 22, 13
  40. 40. Lokaltog/vim-easymotion Sunday, September 22, 13
  41. 41. <Leader> :let mapleader=”<key to use>” • <Leader> is a key reserved for plugins. • Default key is Backslash () Sunday, September 22, 13
  42. 42. <Leader> <Leader> f <Leader> <Leader> F --NORMAL-- {char} {char} EasyMotion Find Character Sunday, September 22, 13
  43. 43. kana/vim-arpeggio Sunday, September 22, 13
  44. 44. Arpeggio inoremap fun function Arpeggio inoremap () ()<Left> Sunday, September 22, 13
  45. 45. Arpeggio inoremap sd <Backspace> Arpeggio inoremap kl <Backspace> Arpeggio nnoremap sdf ciw Arpeggio nnoremap jkl ciw Sunday, September 22, 13
  46. 46. kien/ctrlp.vim Sunday, September 22, 13
  47. 47. scrooloose/syntastic Sunday, September 22, 13
  48. 48. justincampbell/vim-eighties Sunday, September 22, 13
  49. 49. tpope/vim-surround Sunday, September 22, 13
  50. 50. sc Change Surrounding " into ' " ' Sunday, September 22, 13
  51. 51. sd Delete Surrounding Tag t Sunday, September 22, 13
  52. 52. sy Wrap Inside Word wi <span class="sharp"> With <div class="x"> Sunday, September 22, 13
  53. 53. dtinth/vim-colors-dtinth256 Sunday, September 22, 13
  54. 54. ervandew/supertab Sunday, September 22, 13
  55. 55. More Resources Sunday, September 22, 13
  56. 56. • http://usevim.com/ A Vim Blog (← Recommended!) • http://vim.wikia.com/ Vim Tips Wiki • http://www.vim.org/scripts/ Official Script Repository • http://vim-scripts.org/ Git Mirror of the above Sunday, September 22, 13
  57. 57. Q/A Sunday, September 22, 13
  58. 58. Thank You! Sunday, September 22, 13

×