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

Do You Know about Vim Runtime Files?

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.

Linda_pp

November 16, 2013
Tweet

More Decks by Linda_pp

Other Decks in Programming

Transcript

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

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

    7JNΠϯετʔϧ࣌ʹಉ࣌ʹΠϯετʔϧ͞ΕΔ w ·ͱΊͯ঺հ͞Ε͍ͯΔ৘ใ͕ແ͍ͷͰɼࠓճ঺հ͢ Δ͜ͱʹͨ͠  
  3. 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ϑΝΠϧ܈ ϑΝΠϧλΠϓ͝ͱͷσϑΥϧτઃఆ ඪ४ఴ෇ϓϥάΠϯ ඪ४ϓϥάΠϯ νϡʔτϦΞϧ
  4. QMVHJOOFUSX1MVHJOWJN BVUPMPBEOFUSX WJN w ඪ४ͷϑΝΠϥϓϥάΠϯ w σΟϨΫτϦΛࢦఆͯ͠ىಈͨ͠ͱ͖ʹग़ΔΞϨ w ϑΝΠϧͷಡΈॻ͖ɾωοτϫʔΫӽ͠ͷϑΝΠϧӾ ཡ

    w ͔ͳΓେ͖͍ϓϥάΠϯͳͷͰIFMQOFUSXࢀর w 7JN'JMFSͳͲΛ࢖͍ͬͯͯOFUSX͕ཁΒͳ͍ਓ͸ແޮ ԽͰ͖Δ   1 let g:loaded_netrwPlugin = 1
  5. 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 ͰઃఆՄೳ
  6. 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 ͦΖ͏
  7. NBDSPTIBOPJIBOPJWJN NBDSPTMJGFMJGFWJN NBDSPTNB[FNB[FWJN w NB[FWJN w ໎࿏ΛࣗಈͰղ͘ϚΫϩʢ໎࿏ͷੜ੒͸෇ଐͷNB[FD Ͱʣ w MJGFWJN

    w ϥΠϑήʔϜɽϚΫϩͰ࣮૷͞Ε͍ͯΔTP w ϥΠϑήʔϜ͸νϡʔϦϯά׬શ w ੲ͸ੈ୅ͷܭࢉʹ෼͙Β͍͔͔ͬͨΒ͍͠ w IBOPJWJN w ϋϊΠͷౝͰ༡΂Δ  
  8. 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\>'
  9. 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'
  10. 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>
  11. 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
  12. GUQMVHJOSVCZWJN  w ΦϒδΣΫτ୯ҐͰͷҠಈϚοϐϯά   ONBQ YNBQ આ໌ <N

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

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

    <\ɿDSFBUFΦϒδΣΫτ໊ͷ࢝఺ऴ఺ w ϚΫϩఆٛ΁Ҡಈɿ<E <% <$53-% w 42-ํݴ΁ͷରԠ w 42-4FU5ZQFͰઃఆ͢Δʢྫɿ42-4FU5ZQFTRMPSBDMFʣ w छྨͷΦϜχิ׬ w TUBUJDγϯλοΫεϋΠϥΠτΛݩʹϫʔυΛநग़ w EZOBNJDσʔλϕʔε͔Β௚઀நग़ͨ͠ϫʔυΛར༻ʢECFYUWJN͕ඞཁʣ