vimconf-2014-f

Dea1add99f4cf942792c0f185aa2f2fd?s=47 Linda_pp
November 08, 2014

 vimconf-2014-f

About 'f' mapping in Vim. The introduction to the mapping and plugins which extend 'f'.

Dea1add99f4cf942792c0f185aa2f2fd?s=128

Linda_pp

November 08, 2014
Tweet

Transcript

  1. λΠτϧςΩετ f 7JN$POG 

  2. @Linda_pp @rhysd id:rhysd 

  3. Vim ͷ f Ϛοϐϯά͓͞Β͍ 

  4. Vim ͷ f{char} Ϛοϐϯά No, Vim is a text editor.

    GU   N t t t Χʔιϧ 
  5. Vim ͷ f{char} Ϛοϐϯά • [count]f{char} • ݱࡏͷΧʔιϧҐஔ͔Β [count] ൪໨ʹݱΕΔ

    จࣈ {char} ʹΧʔιϧΛδϟϯϓ͢Δ • ; ͰҎલͷݕࡧΛલํʹ܁Γฦ͠ɼ, Ͱޙํʹ܁ Γฦ͢ • ٯํ޲ʹݕࡧ͍ͨ͠ͱ͖͸ [count]F{char} 
  6. Vim ͷ t{char} Ϛοϐϯά No, Vim is a text editor.

    UU   N x i e 
  7. Vim ͷ t{char} Ϛοϐϯά • [count]t{char} • ݱࡏͷΧʔιϧҐஔ͔Β [count] ൪໨ʹݱΕΔ

    จࣈ {char} ͷ௚લʹΧʔιϧΛδϟϯϓ͢Δ • ; ͰҎલͷݕࡧΛલํʹ܁Γฦ͠ɼ, Ͱޙํʹ܁ Γฦ͢ • ٯํ޲ʹݕࡧ͍ͨ͠ͱ͖͸ [count]T{char} 
  8. bar omap ΋ศར • _ ·Ͱফ͍ͨ͠ → df_ ! •

    {aaa: 1+2} Ͱ value ͚ͩফ͍ͨ͠ → dt} ! • dd ΍ yy ͷΑ͏ʹɼyf_ɼyt: ͳͲ΋Մೳ foo_bar f b EG@ {aaa: } {aaa: 1+2} } EU^  1
  9. f Ϛοϐϯά֦ுϓϥάΠϯ 

  10. vim-shot-f f ೖྗ࣌఺ͰҰൃͰඈ΂Δจࣈ͕ϋΠϥΠτ ͞ΕΔ IUUQTHJUIVCDPNEFSJTWJNTIPUG No, Vim is a text

    editor. No, Vim s a G tex d r. No, Vim is a text editor. N d GE ϋΠϥΠτ 
  11. vim-shot-f • جຊతͳಈ࡞͸σϑΥϧτͷ f ͱมΘΒͳ͍ Α͏ʹઃܭ͞Ε͍ͯΔ • 1ճͷδϟϯϓͰඈ΂Δൣғ͕෼͔ΔͷͰɼ܁ Γฦ͢ඞཁ͕͋Δ͔Ͳ͏͔͕ઌʹΘ͔Δ 

    IUUQTHJUIVCDPNEFSJTWJNTIPUG
  12. improvedft f{char}… ͰݱࡏߦͷҐஔΛߜΓࠐΜͰ͍͘ IUUQTHJUIVCDPNDISJTCSBJNQSPWFEGU No, Vim is a text editor.

    N GU t No, Vim is a text editor. N o GUP t t 
  13. improvedft • f ͷޙʹ {char} ΛೖΕͯݱࡏߦͷதͷҐஔΛߜΓࠐΜ Ͱ͍͘ • ީิ͕1Օॴʹͳͬͨ࣌఺Ͱδϟϯϓɼ΋͘͠͸ <Enter>ೖྗͰ࠷ॳͷީิ΁δϟϯϓ

    • ඈͼ͍ͨ৔ॴͷςΩετΛೖྗ͍ͯ͘͠ײ͡ • e.g.ɹfoo bar baz Ͱ baz ͷҐஔʹඈͼ͍ͨͳΒ baz ͱೖྗ͢Ε͹ྑ͍  IUUQTHJUIVCDPNDISJTCSBJNQSPWFEGU
  14. clever-f.vim f{char} ͷޙɼf Ͱલํʹ܁Γฦ͠ҠಈͰ͖Δ ʢF Ͱޙํʣ IUUQTHJUIVCDPNSIZTEDMFWFSGWJN No, Vim is

    a text editor. p G G ' ' N i i i 
  15. clever-f.vim • f{char} Ͱݕࡧͨ͠ͱ͖ͷ੎͍Ͱͦͷ·· ff.. ͱδϟϯ ϓ͍͚ͯ͠Δ • ܁Γฦ͠Ҡಈ͸λʔήοτͷจࣈͷ্ʹ͍ΔؒͷΈ༗ ޮ

    • ; ͱ , ͕ෆཁʢf ΍ t ͚ͩͰ܁Γฦ͠ݕࡧͰ͖Δ • ϋΠϥΠτɼߦΛލ͛Δɼsmart-caseɼmigemoɼetc  IUUQTHJUIVCDPNSIZTEDMFWFSGWJN
  16. growshi-ft.vim f{char} ͷޙɼl ͱ h ͰλʔήοτͷจࣈؒΛ ҠಈͰ͖Δ IUUQTHJUIVCDPNTBJIPPPPPPPPHMPXTIJGUWJN No, Vim

    is a text editor. GU M M I I N t t t 
  17. growshi-ft.vim • f{char} ͰλʔήοτΛܾΊͨΒޙ͸ l ͱ h Ͱ ௚ײతʹࠨӈʹҠಈ •

    l ͱ h ʹΑΔҠಈ͸λʔήοτͷจࣈͷ্ʹ͍ Δ͚ؒͩ༗ޮ • ܁Γฦ͠ʹ ; ͱ , ͕ཁΒͳ͍  IUUQTHJUIVCDPNTBJIPPPPPPPPHMPXTIJGUWJN
  18. vim-sneak s{char}{char} ͷ2จࣈͰδϟϯϓ͢Δ IUUQTHJUIVCDPNHPMEGFMEWJNTFFL foo, bar, baz, qux TCB f

    b  b 
  19. vim-sneak • s{char}{char} ͷ2จࣈͰδϟϯϓ͢ΔͷͰɼೖ ྗจࣈ͸ଟ͍͕ΑΓਫ਼౓͕ߴ͍ • clever-f.vim ͷΑ͏ʹॳճݕࡧޙ s ͱ

    S Ͱݕࡧ ީิؒΛҠಈͰ͖Δઃఆ΋͋Δ • ଞʹ΋1จࣈͰδϟϯϓͰ͖Δػೳ΍ vim- easymotion ͬΆ͍ػೳͳͲ৭ʑ͋Δ  IUUQTHJUIVCDPNHPMEGFMEWJNTFFL
  20. vim-easymotion <Plug>(easymotion-s2) Most of the manuals assume that Vim has

    been properly installed. If you didn't do that yet, or if Vim doesn't run properly first read the chapter on. IUUQTHJUIVCDPN-PLBMUPHWJNFBTZNPUJPO ߦ͖͍ͨՕॴͷ2จࣈೖྗͰը໘্ʹϥϕϧ Λදࣔ͠ɼೖྗͨ͠ϥϕϧʹδϟϯϓ͢Δ M 
  21. vim-easymotion <Plug>(easymotion-s2) Most of the manuals assume that Vim has

    been properly installed. If you didn't do that yet, or if Vim doesn't run properly first read the chapter on. ߦ͖͍ͨՕॴͷ2จࣈೖྗͰը໘্ʹϥϕϧ Λදࣔ͠ɼೖྗͨ͠ϥϕϧʹδϟϯϓ͢Δ ೖྗɿTUI B T E H ϥϕϧ M  IUUQTHJUIVCDPN-PLBMUPHWJNFBTZNPUJPO
  22. vim-easymotion <Plug>(easymotion-s2) Most of the manuals assume that Vim has

    been properly installed. If you didn't do that yet, or if Vim doesn't run properly first read the chapter on. ߦ͖͍ͨՕॴͷ2จࣈೖྗͰը໘্ʹϥϕϧ Λදࣔ͠ɼೖྗͨ͠ϥϕϧʹδϟϯϓ͢Δ ೖྗɿTUIH t  IUUQTHJUIVCDPN-PLBMUPHWJNFBTZNPUJPO
  23. vim-easymotion • s{char}{char} Ͱ2จࣈΛؚΉҐஔʹϥϕϧ͕ష ΒΕΔɽͦͷϥϕϧΛೖྗͯ͠δϟϯϓ • δϟϯϓީิ͕1ͭͳΒͦͷ··δϟϯϓ • ϥϕϧΛݟͯೖྗ͢Δखؒ͸͋Δ͕ɼը໘্ ͷ޷͖ͳҐஔʹҠಈͰ͖Δ

    • େ͖͍ϓϥάΠϯͰɼϥϕϧͷషΓํ͸৭ʑ ͋Δ  IUUQTHJUIVCDPN-PLBMUPHWJNFBTZNPUJPO
  24. ͦͷଞͷ f ֦ுϓϥάΠϯ • vim-smalls • wiseman-f • vim-fanfingtastic •

    extended-ft • vim-seek 
  25. ࣗ෼ͷ࢖͍ํ جຊతʹ͸ clever-f.vim Ͱɼۭ͍ͨΩʔ , Λ <Leader> ʹɼ; Λ <Plug>(easymotion-s2)

    ʹ࢖͍ͬͯΔ 
  26. WJNTIPUG JNQSPWFEGU DMFWFSG WJNTOFBL HSPXTIJGU FBTZNPUJPO XJTFNBOG FYUFOEFEGU WJNTNBMMT WJNTFFL

    IUUQUXJUUFSDPN-JOEB@QQTUBUVT 
  27. ·ͱΊ • Vim ͷ f Ϛοϐϯάͱͦͷ֦ுϓϥάΠϯʹ ͍ͭͯ঺հͨ͠ • ීஈ l

    ΍ w Λ࿈ଧͯ͠Ҡಈ͍ͯ͠Δਓ΋ɼੋ ඇҰ౓ࢼͯ͠Έͯ΄͍͠ • ΧʔιϧͷԣҠಈ͸සൃ͢ΔͷͰɼ͜Ε͔Β ΋վળ͍͖͍ͯͨ͠