Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Do You Know about Vim Runtime Files?

Dea1add99f4cf942792c0f185aa2f2fd?s=47 Linda_pp
November 16, 2013

Do You Know about Vim Runtime Files?

There are many runtime files in Vim. They are loaded at vim starting up and provides many useful features. You can use them without installing any plugins. However, these files are not known well. I will introduce them with setting examples.

Dea1add99f4cf942792c0f185aa2f2fd?s=128

Linda_pp

November 16, 2013
Tweet

Transcript

  1. %P:PV,OPX"CPVU7JN #VJMUJO3VOUJNF'JMFT WJNDPOG /PW A

  2. ࣗݾ঺հ w !-JOEB@QQ·ͨ͸SIZTE w 5XJUUFSIUUQTUXJUUFSDPN-JOEB@QQ w (JUIVCIUUQTHJUIVCDPNSIZTE w )BUFOB#MPHIUUQSIZTEIBUFOBCMPHDPN w

    $ 3VCZ 7JNʢ7JNྺ೥ʣ ݘ͕޷͖ w ࣾձਓ೥໨ʢιϑτ΢ΣΞΤϯδχΞʣ w ϓϥάΠϯॻ͍ͨΓͯ͠·͢ w DMFWFSGWJN w WJNPQFSBUPSTVSSPVOEʜͦͷଞ͍ͬͺ͍  
  3. 7JNͷSVOUJNFϑΝΠϧͱ͸ w ඪ४ͷ7JNεΫϦϓτ܈ w QBUIUPTIBSFWJNWJN w QBUIUP.BD7JNBQQ$POUFOUT3FTPVSDFTWJNSVOUJNF w ͳͲҎԼʹ͋Δ w

    7JNΠϯετʔϧ࣌ʹಉ࣌ʹΠϯετʔϧ͞ΕΔ w ·ͱΊͯ঺հ͞Ε͍ͯΔ৘ใ͕ແ͍ͷͰɼࠓճ঺հ͢ Δ͜ͱʹͨ͠  
  4. SVOUJNFϑΝΠϧΛ஌Δͱ Կ͕ྑ͍ͷ͔ w ϓϥάΠϯͷΑ͏ʹΠϯετʔϧ͢Δඞཁ͸ແ͍ w αʔόͰͷฤू࡞ۀͳͲͰ΋࢖͍΍͍͢ʢVOJUF TTI࢖͏ͱ͍ͬͨख΋͋Δʣ w ΋ͱ΋ͱ͋ΔػೳΛ࢖Θͣʹंྠͷ࠶ൃ໌ͯ͠͠· ͏ͷΛ๷͙

     
  5. SVOUJNFϑΝΠϧͷߏ੒ 1 - runtime/ [D]! 2 |+ autoload/ [D]! 3

    |+ colors/ [D]! 4 |+ compiler/ [D]! 5 |+ doc/ [D]! 6 |+ ftplugin/ [D]! 7 |+ icons/ [D]! 8 |+ indent/ [D]! 9 |+ keymap/ [D]! 10 |+ lang/ [D]! 11 |+ macros/ [D]! 12 |+ plugin/ [D]! 13 |+ print/ [D]! 14 |+ spell/ [D]! 15 |+ syntax/ [D]! 16 |+ tools/ [D]! 17 |+ tutor/ [D]! 18 | bugreport.vim! 19 | delmenu.vim! 20 | doc.info [X]! 21 | evim.vim! 22 | filetype.vim! 23 | ftoff.vim! 24 | ftplugin.vim! 25 | ftplugof.vim! 26 | gvimrc_example.vim! 50 | vim48x48.gif [I]! 51 | vim48x48.png [I]! 52 | vim48x48.xpm! 53 | vimlogo.cdr! 54 | vimlogo.eps! 55 | vimlogo.gif [I]! 56 | vimlogo.pdf! 57 | vimlogo.xpm! 58 | vimrc_example.vim! … w ศརͦ͏ͳ΋ͷΛϐοΫΞοϓ͠ ͯ঺հ w ɻPʢ&NBDTͩͱͲΕ͚ͩ঺հͯ͠΋ऴΘΒͳͦ͞͏ʣ ΧϥʔεΩʔϜ IFMQϑΝΠϧ܈ ϑΝΠϧλΠϓ͝ͱͷσϑΥϧτઃఆ ඪ४ఴ෇ϓϥάΠϯ ඪ४ϓϥάΠϯ νϡʔτϦΞϧ
  6. 7*.36/5*.&

  7. CVHSFQPSUWJN w 7JNͷόάϨϙʔτʹར༻͢ΔCVHSFQPSUUYUΛ ੜ੒͢ΔεΫϦϓτ w TP7*.36/5*.&CVHSFQPSUWJN  

  8. FWJNWJN w 7JNʹ8JOEPXTϥΠΫͳγϣʔτΧοτΛ௥Ճ ʢNTXJOWJNʣ͠ɼΠϯαʔτϞʔυઐ༻ʹ͢Δ w ʮ7JN͸࢖͍ͨ͘ͳ͍͚Ͳɼαʔό؅ཧͳͲͰͲ ͏ͯ͠΋࢖Θͳ͚Ε͹͍͚ͳ͍ʜʯͱ͍͏ਓ޲͚ w TP7*.36/5*.&FWJNWJN͔WJNZͰىಈ ͢Δ

     
  9. NBDNBQWJN w .BDͷ㵰ΩʔΛ࢖ͬͨΩʔϚοϓΛఆٛ͢Δ w NTXJOWJNͷ.BD൛ w TP7*.36/5*.&NBDNBQWJNͰಡΈࠐΉ  

  10. 7*.36/5*.&QMVHJO 7*.36/5*.&BVUPMPBE

  11. QMVHJOOFUSX1MVHJOWJN BVUPMPBEOFUSX WJN w ඪ४ͷϑΝΠϥϓϥάΠϯ w σΟϨΫτϦΛࢦఆͯ͠ىಈͨ͠ͱ͖ʹग़ΔΞϨ w ϑΝΠϧͷಡΈॻ͖ɾωοτϫʔΫӽ͠ͷϑΝΠϧӾ ཡ

    w ͔ͳΓେ͖͍ϓϥάΠϯͳͷͰIFMQOFUSXࢀর w 7JN'JMFSͳͲΛ࢖͍ͬͯͯOFUSX͕ཁΒͳ͍ਓ͸ແޮ ԽͰ͖Δ   1 let g:loaded_netrwPlugin = 1
  12. QMVHJONBUDIQBSFOWJN w ରԠ͢ΔׅހΛϋΠϥΠτ͢ΔϓϥάΠϯ w ΧʔιϧҠಈ͓࣌Αͼ΢Οϯυ΢Ҡಈ࣌ʹׅހ͕ϋ ΠϥΠτ͞ΕΔ w Χʔιϧ͕ॏͳͬͨ࣌ݟͮΒ͍ˠແޮʹͰ͖Δ  

    1 let g:loaded_matchparen = 1
  13. QMVHJOTQFMMpMFWJN BVUPMPBETQFMMpMFWJN w 7JNඪ४౥ࡌͷεϖϧνΣοΫػೳ w 'JMF5ZQFHJUDPNNJUͳͲͰσϑΥϧτ0/ʹ͠ ͓ͯ͘ͱศར w ϦϞʔτʹ͋ΔࣙॻϑΝΠϧΛऔಘ͢Δػೳ΋͋Δ !

    w dWJNTQFMMʹอଘ͞ΕΔ   1 call spellfile#LoadFile('en')! 2 " σϑΥϧτͰ http://ftp.vim.org/pub/vim/runtime/spell Λݟʹߦ͘! 3 " g:spellfile_URL ͰઃఆՄೳ
  14. QMVHJOUBS1MVHJOWJN QMVHJO[JQ1MVHJOWJN QMVHJOH[JQWJN w 7JN͔ΒѹॖϑΝΠϧΛ௚઀։͘ϓϥάΠϯ w #VG3FBE$NE΍'JMF3FBE$NEͰϑΝΠϧΛ։ ͍ͨͱ͖ʹࣗಈͰల։ͯ͘͠ΕΔ w ࣮͸[JQͳϑΝΠϧʢQQUYͱ͔ʣ΋উखʹల։͠

    ͯ͘ΕΔʢHQ1MVHJO@FYUͰઃఆͰ͖Δʣ  
  15. QMVHJOUPIUNMWJN BVUPMPBEUPIUNMWJN w ݱࡏͷόοϑΝΛIUNMܗࣜʹม׵ͯ͘͠ΕΔ w εϥΠυ΍ϒϩάʹࡌͤΔͱ͖ʹศར w 50IUNMͰม׵ˠม׵ޙͷόοϑΝΛίϐʔˠ షΓ෇͚Δ w

    ൣғΛࢦఆͰ͖Δ   1 " 1ʙ10 ߦ໨Λม׵! 2 :1,10TOhtml
  16. 7*.36/5*.&NBDSPT

  17. NBDSPTҎԼͷϓϥάΠϯ ͷϩʔυํ๏ w NBDSPTҎԼͷεΫϦϓτ͸ࣗಈͰ͸ಡΈࠐ·Ε ͳ͍ w SVOUJNFͰಡΈࠐΉ͔ɼdWJNQMVHJOҎԼʹγ ϯϘϦοΫϦϯΫΛషΔ  

    1 :runtime macros/matchit.vim! 2 :runtime macros/justify.vim
  18. NBDSPTEWPSBL w EWPSBL഑ྻ΍RXFSUZ഑ྻ༻ͷϚοϐϯά͕ॻ͔ Ε͍ͯΔ w ௚઀ಡΈࠐΉͷͰ͸ͳ͘ɼdEWPSBL΍dRXFSUZ ʹ֘౰෦෼Λίϐϖͯ͠TPVSDFͰಡΈࠐΉ w ಥવEWPSBL഑ྻ΍RXFSUZ഑ྻΛ࢖Θͳ͍ͱ͍ ͚ͳ͘ͳͬͨͱ͖ʹ΋ศར

     
  19. NBDSPTKVTUJGZWJN w ୯ޠؒͷεϖʔε਺Λௐઅͯ͠ςΩετͷԣ෯ΛҰख ʹ͢ΔϓϥάΠϯ ! ! w ඪ४Ͱ@K΍ HRΛఆٛ͢ΔͷͰ஫ҙʢ HRͰVOEPʣ

      1 :[range]Justify [ textwidth [ maxspaces [ indent] ] ] 1 Permission is hereby granted, free of charge, to any person obtaining! 2 a copy of this software and associated documentation files (the! 3 "Software"), to deal in the Software without restriction, including! 4 without limitation the rights to use, copy, modify, merge, publish,! 5 distribute, sublicense, and/or sell copies of the Software, and to! 6 permit persons to whom the Software is furnished to do so, subject to 1 Permission is hereby granted, free of charge, to any person obtaining! 2 a copy of this software and associated documentation files (the! 3 "Software"), to deal in the Software without restriction, including! 4 without limitation the rights to use, copy, modify, merge, publish,! 5 distribute, sublicense, and/or sell copies of the Software, and to! 6 permit persons to whom the Software is furnished to do so, subject to ͦΖ͏
  20. NBDSPTTXBQNPVTWJN w ӈΫϦοΫͱࠨΫϦοΫΛೖΕସ͑Δ w ࠨར͖Ϣʔβ༻ w TFUNPVTFB͕ඞཁ  

  21. NBDSPTIBOPJIBOPJWJN NBDSPTMJGFMJGFWJN NBDSPTNB[FNB[FWJN w NB[FWJN w ໎࿏ΛࣗಈͰղ͘ϚΫϩʢ໎࿏ͷੜ੒͸෇ଐͷNB[FD Ͱʣ w MJGFWJN

    w ϥΠϑήʔϜɽϚΫϩͰ࣮૷͞Ε͍ͯΔTP w ϥΠϑήʔϜ͸νϡʔϦϯά׬શ w ੲ͸ੈ୅ͷܭࢉʹ෼͙Β͍͔͔ͬͨΒ͍͠ w IBOPJWJN w ϋϊΠͷౝͰ༡΂Δ  
  22. NBDSPTNBUDIJUWJN w ରԠׅހδϟϯϓΛ֦ுɽ֤ݴޠͷϒϩοΫͷ࢝·Γ ͱରԠ͢ΔऴΘΓʹδϟϯϓͰ͖Δ w ྫ͑͹3VCZͷEFGdFOE΍$ͷJGdFOEJGͳͲ w ରԠݴޠɿBCBRVT BEB BTQWCT

    D DMPKVSF DPCPM DPOUFYU DTD DTI EUE EUSBDF FSVCZ GBMDPO  GPSUSBO GSBNFTDSJQU IBNM IBNTUFS IUNM JTIE KTQ MJRVJE MVB NBLF NBUMBC QBTDBM QEG QFSM  QIQ QMBJOUFY QPTUTDS SVCZ TI TQFD TRM UFY WC WFSJMPH WIEM WJN YIUNM YNM [JNCV w CNBUDI@XPSEͰಠࣗఆٛͰ͖Δ   1 " vim-vspec ͷ it...end ΍ describe...end ؒͳͲΛҠಈ͢Δ! 2 :autocmd FileType vim.vspec! 3 \ let b:match_words .=! 4 \ ',\<it\>:\<end\>,\<describe\>:\<end\>,\<before\>:\<end\>,\<after\>:\<end\>'
  23. MFTTWJN w 7JNͰMFTTΛΤϛϡϨʔτ͢Δ w 7JNͷϋΠϥΠτ΍ίϚϯυΛར༻Ͱ͖Δ w ΩʔϚοϓ͸MFTTΛ໛ٖ w 36/5*.&NBDSPTMFTTTI w

    BMJBTWJNMFTTQBUIUPSVOUJNFNBDSPTMFTTTI  
  24. 7*.36/5*.&GUQMVHJO

  25. GUQMVHJONBOWJN w NBOίϚϯυ༻ઃఆ w .BO\OBNF^ɿ7JN಺ͰNBOQBHFΛݟΔ w $53->΍$53-5Ͱ7JNͷIFMQͷΑ͏ʹҠ ಈͰ͖Δ w -FBEFSLΛάϩʔόϧʹఆٛ͢ΔɽΧʔιϧԼ

    ͷϫʔυΛNBOͰݕࡧ͢Δɽ  
  26. GUQMVHJODIBOHFMPHWJN w νΣϯδϩά༻ͷઃఆϑΝΠϧ w νΣϯδϩάϑΝΠϧΛ։͖ɼ/FX$IBOHFMPH&OUSZ ͔-FBEFSPͰ௥Ճ͢Δ w ϑΥʔϚοτ͸ม਺ͰࢦఆͰ͖Δ  

    1 let g:changelog_format = '%Y-%m-%d'! 2 let g:changelog_username = 'Full Name <e@mail>'! 3 " νΣϯδϩά࡞੒࣌ͷϑΥʔϚοτ! 4 " %u : Ϣʔβ৘ใ! 5 " %d : ೔෇! 6 " %c : ΧʔιϧҐஔ! 7 let g:changelog_new_date_format = "%d %u\n%c"! 8 " ࠷ޙͷΤϯτϦͷऴ୺Λ୳ͨ͢Ίͷύλʔϯ! 9 let g:changelog_date_end_entry_search = '^\s*$'! 10 ೔෇ΤϯτϦͷऴ୺Λ୳ͨ͢Ίͷݕࡧύλʔϯɻ! 11 g:changelog_new_date_formatʹ͓͚ΔτʔΫϯͱಉ͡΋ͷ! 12 ͕࢖༻Ͱ͖ΔɻσϑΥϧτ͸ '^\s*$' ͰɺۭനจࣈͷΈΛ! 13 ؚΉߦ·ͨ͸׬શͳۭߦΛݕࡧ͢Δɻ! 14 let b:changelog_name = 'ChangeLog'
  27. GUQMVHJOHJUSFCBTFWJN w HJUSFCBTF࣌ͷϑΝΠϧฤू༻ઃఆ w ֤ίϛοτͷॲཧʢQJDL TRVBTI FEJU SFXPSE  pYVQʣͷهड़Λ੾Γସ͑ΒΕΔίϚϯυ܈

    w ΩʔϚοϓΛઃఆ͓ͯ͘͠ͱศར   1 autocmd FileType gitrebase nnoremap <buffer>p :<C-u>Pick<CR>! 2 autocmd FileType gitrebase nnoremap <buffer>s :<C-u>Squash<CR>! 3 autocmd FileType gitrebase nnoremap <buffer>e :<C-u>Edit<CR>! 4 autocmd FileType gitrebase nnoremap <buffer>r :<C-u>Reword<CR>! 5 autocmd FileType gitrebase nnoremap <buffer>f :<C-u>Fixup<CR>
  28. pMFUZQFPDBNMWJN w 0$BNM༻ɽࠓ೥ʹೖ͔ͬͯΒ͔ͳΓϝϯς͞Ε͍ͯΔ w NMJϑΝΠϧͱNMϑΝΠϧؒͷҠಈ w -PDBM-FBEFST -PDBM-FBEFS4 w ίϝϯτΞϯίϝϯτʢʁʣ

    w -PDBM-FBEFSD -PDBM-FBEFS$ w ܕͷදࣔ w -PDBM-FBEFSU   ˞ͪͳΈʹɼϑΝΠϧλΠϓ ͝ͱͷϚοϐϯάΛউखʹ͞Ε ͨ͘ͳ͚Ε͹ MFUHOP@QMVHJO@NBQT
  29. GUQMVHJOSVCZWJN  w 5JN1PQF͞Μ͕ϝϯςφ w Ϛ΢εΧʔιϧԼͷࣝผࢠ͕SJͰࣗಈݕࡧ͞Εɼό ϧʔϯͰදࣔ͞ΕΔ w όϧʔϯɿH7JNͰϚ΢εΧʔιϧΦʔόʔ͢Δͱදࣔ͞ΕΔϙοϓΞο ϓ

    w HG΍$XGͷ3VCZରԠɿSFRVJSFઌΛ։͘ w $>ͳͲʹΑΔλάδϟϯϓͷ3VCZରԠ  
  30. GUQMVHJOSVCZWJN  w ΦϒδΣΫτ୯ҐͰͷҠಈϚοϐϯά   ONBQ YNBQ આ໌ <N

    ޙํͷϝιουఆ ٛͷ։࢝఺ >N લํͷϝιουఆ ٛͷ։࢝఺ <. ޙํͷϝιουఆ ٛͷऴྃ఺ >. લํͷϝιουఆ ٛͷऴྃ఺ ONBQ YNBQ આ໌ << ޙํͷΫϥεɾϞδ ϡʔϧఆٛͷ։࢝఺ >> લํͷΫϥεɾϞδ ϡʔϧఆٛͷ։࢝఺ <> ޙํͷΫϥεɾϞδ ϡʔϧఆٛͷऴྃ఺ >< લํͷΫϥεɾϞδ ϡʔϧఆٛͷऴྃ఺
  31. GUQMVHJOSVCZWJN  w ςΩετΦϒδΣΫτϚοϐϯά   PNBQ YNBQ આ໌ JN

    ϝιουఆٛ಺෦ ʢEFGͱFOEͷߦΛআ͘ʣ BN ϝιουఆٛશମ ʢEFGͱFOEͷߦΛؚΉʣ J. ΫϥεɾϞδϡʔϧఆٛ಺෦ ʢDMBTTNPEVMFͱFOEͷߦΛআ͘ B. ΫϥεɾϞδϡʔϧఆٛ಺෦ ʢDMBTTNPEVMFͱFOEͷߦΛআ͘ ྫ͑͹ɼEJNͰϝιου ಺Λ࡟আͨ͠ΓɼWB. ͰΫϥεɾϞδϡʔϧ಺ Λબ୒Ͱ͖ͨΓ͢Δ
  32. GUQMVHJOTRMWJN w ҠಈܥϚοϐϯά w >> << <> ><ɿCFHJOFOEͷ࢝఺ऴ఺ w >^

    <\ɿDSFBUFΦϒδΣΫτ໊ͷ࢝఺ऴ఺ w ϚΫϩఆٛ΁Ҡಈɿ<E <% <$53-% w 42-ํݴ΁ͷରԠ w 42-4FU5ZQFͰઃఆ͢Δʢྫɿ42-4FU5ZQFTRMPSBDMFʣ w छྨͷΦϜχิ׬ w TUBUJDγϯλοΫεϋΠϥΠτΛݩʹϫʔυΛநग़ w EZOBNJDσʔλϕʔε͔Β௚઀நग़ͨ͠ϫʔυΛར༻ʢECFYUWJN͕ඞཁʣ  
  33. ·ͱΊ w 7JNͷSVOUJNFϑΝΠϧͷத͔Βศརͦ͏ͳ΋ͷ ΛબΜͰ঺հͨ͠ w ͔ͤͬ͘ඪ४Ͱ͍ͭͯ͘ΔεΫϦϓτͳͷͰɼͬ͠ ͔Γ׆༻͢΂͖ w ͦΕ7JNͰग़དྷΔΑʂˠͦΕσϑΥϧτͷ7JN Ͱ΋ग़དྷΔΑʂ