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

vimconf-2014-f

Linda_pp
November 08, 2014

 vimconf-2014-f

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

Linda_pp

November 08, 2014
Tweet

More Decks by Linda_pp

Other Decks in Technology

Transcript

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

    View full-size slide

  2. @Linda_pp
    @rhysd
    id:rhysd

    View full-size slide

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

    View full-size slide

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


    N t t t
    Χʔιϧ

    View full-size slide

  5. Vim ͷ f{char} Ϛοϐϯά
    • [count]f{char}
    • ݱࡏͷΧʔιϧҐஔ͔Β [count] ൪໨ʹݱΕΔ
    จࣈ {char} ʹΧʔιϧΛδϟϯϓ͢Δ
    • ; ͰҎલͷݕࡧΛલํʹ܁Γฦ͠ɼ, Ͱޙํʹ܁
    Γฦ͢
    • ٯํ޲ʹݕࡧ͍ͨ͠ͱ͖͸ [count]F{char}

    View full-size slide

  6. Vim ͷ t{char} Ϛοϐϯά
    No, Vim is a text editor.
    UU


    N x i
    e

    View full-size slide

  7. Vim ͷ t{char} Ϛοϐϯά
    • [count]t{char}
    • ݱࡏͷΧʔιϧҐஔ͔Β [count] ൪໨ʹݱΕΔ
    จࣈ {char} ͷ௚લʹΧʔιϧΛδϟϯϓ͢Δ
    • ; ͰҎલͷݕࡧΛલํʹ܁Γฦ͠ɼ, Ͱޙํʹ܁
    Γฦ͢
    • ٯํ޲ʹݕࡧ͍ͨ͠ͱ͖͸ [count]T{char}

    View full-size slide

  8. bar
    omap ΋ศར
    • _ ·Ͱফ͍ͨ͠ → df_
    !
    • {aaa: 1+2} Ͱ value ͚ͩফ͍ͨ͠ → dt}
    !
    • dd ΍ yy ͷΑ͏ʹɼyf_ɼyt: ͳͲ΋Մೳ
    foo_bar
    f b
    EG@
    {aaa: }
    {aaa: 1+2} }
    EU^

    1

    View full-size slide

  9. f Ϛοϐϯά֦ுϓϥάΠϯ

    View full-size slide

  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 ϋΠϥΠτ

    View full-size slide

  11. vim-shot-f
    • جຊతͳಈ࡞͸σϑΥϧτͷ f ͱมΘΒͳ͍
    Α͏ʹઃܭ͞Ε͍ͯΔ
    • 1ճͷδϟϯϓͰඈ΂Δൣғ͕෼͔ΔͷͰɼ܁
    Γฦ͢ඞཁ͕͋Δ͔Ͳ͏͔͕ઌʹΘ͔Δ
    IUUQTHJUIVCDPNEFSJTWJNTIPUG

    View full-size slide

  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

    View full-size slide

  13. improvedft
    • f ͷޙʹ {char} ΛೖΕͯݱࡏߦͷதͷҐஔΛߜΓࠐΜ
    Ͱ͍͘
    • ީิ͕1Օॴʹͳͬͨ࣌఺Ͱδϟϯϓɼ΋͘͠͸
    ೖྗͰ࠷ॳͷީิ΁δϟϯϓ
    • ඈͼ͍ͨ৔ॴͷςΩετΛೖྗ͍ͯ͘͠ײ͡
    • e.g.ɹfoo bar baz Ͱ baz ͷҐஔʹඈͼ͍ͨͳΒ
    baz ͱೖྗ͢Ε͹ྑ͍
    IUUQTHJUIVCDPNDISJTCSBJNQSPWFEGU

    View full-size slide

  14. clever-f.vim
    f{char} ͷޙɼf Ͱલํʹ܁Γฦ͠ҠಈͰ͖Δ
    ʢF Ͱޙํʣ
    IUUQTHJUIVCDPNSIZTEDMFWFSGWJN
    No, Vim is a text editor.
    p G G
    '
    '
    N i i i

    View full-size slide

  15. clever-f.vim
    • f{char} Ͱݕࡧͨ͠ͱ͖ͷ੎͍Ͱͦͷ·· ff.. ͱδϟϯ
    ϓ͍͚ͯ͠Δ
    • ܁Γฦ͠Ҡಈ͸λʔήοτͷจࣈͷ্ʹ͍ΔؒͷΈ༗
    ޮ
    • ; ͱ , ͕ෆཁʢf ΍ t ͚ͩͰ܁Γฦ͠ݕࡧͰ͖Δ
    • ϋΠϥΠτɼߦΛލ͛Δɼsmart-caseɼmigemoɼetc
    IUUQTHJUIVCDPNSIZTEDMFWFSGWJN

    View full-size slide

  16. growshi-ft.vim
    f{char} ͷޙɼl ͱ h ͰλʔήοτͷจࣈؒΛ
    ҠಈͰ͖Δ
    IUUQTHJUIVCDPNTBJIPPPPPPPPHMPXTIJGUWJN
    No, Vim is a text editor.
    GU M M
    I
    I
    N t t t

    View full-size slide

  17. growshi-ft.vim
    • f{char} ͰλʔήοτΛܾΊͨΒޙ͸ l ͱ h Ͱ
    ௚ײతʹࠨӈʹҠಈ
    • l ͱ h ʹΑΔҠಈ͸λʔήοτͷจࣈͷ্ʹ͍
    Δ͚ؒͩ༗ޮ
    • ܁Γฦ͠ʹ ; ͱ , ͕ཁΒͳ͍
    IUUQTHJUIVCDPNTBJIPPPPPPPPHMPXTIJGUWJN

    View full-size slide

  18. vim-sneak
    s{char}{char} ͷ2จࣈͰδϟϯϓ͢Δ
    IUUQTHJUIVCDPNHPMEGFMEWJNTFFL
    foo, bar, baz, qux
    TCB
    f b

    b


    View full-size slide

  19. vim-sneak
    • s{char}{char} ͷ2จࣈͰδϟϯϓ͢ΔͷͰɼೖ
    ྗจࣈ͸ଟ͍͕ΑΓਫ਼౓͕ߴ͍
    • clever-f.vim ͷΑ͏ʹॳճݕࡧޙ s ͱ S Ͱݕࡧ
    ީิؒΛҠಈͰ͖Δઃఆ΋͋Δ
    • ଞʹ΋1จࣈͰδϟϯϓͰ͖Δػೳ΍ vim-
    easymotion ͬΆ͍ػೳͳͲ৭ʑ͋Δ
    IUUQTHJUIVCDPNHPMEGFMEWJNTFFL

    View full-size slide

  20. vim-easymotion (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

    View full-size slide

  21. vim-easymotion (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

    View full-size slide

  22. vim-easymotion (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

    View full-size slide

  23. vim-easymotion
    • s{char}{char} Ͱ2จࣈΛؚΉҐஔʹϥϕϧ͕ష
    ΒΕΔɽͦͷϥϕϧΛೖྗͯ͠δϟϯϓ
    • δϟϯϓީิ͕1ͭͳΒͦͷ··δϟϯϓ
    • ϥϕϧΛݟͯೖྗ͢Δखؒ͸͋Δ͕ɼը໘্
    ͷ޷͖ͳҐஔʹҠಈͰ͖Δ
    • େ͖͍ϓϥάΠϯͰɼϥϕϧͷషΓํ͸৭ʑ
    ͋Δ
    IUUQTHJUIVCDPN-PLBMUPHWJNFBTZNPUJPO

    View full-size slide

  24. ͦͷଞͷ f ֦ுϓϥάΠϯ
    • vim-smalls
    • wiseman-f
    • vim-fanfingtastic
    • extended-ft
    • vim-seek

    View full-size slide

  25. ࣗ෼ͷ࢖͍ํ
    جຊతʹ͸ clever-f.vim Ͱɼۭ͍ͨΩʔ , Λ
    ʹɼ; Λ (easymotion-s2)
    ʹ࢖͍ͬͯΔ

    View full-size slide

  26. WJNTIPUG
    JNQSPWFEGU
    DMFWFSG
    WJNTOFBL
    HSPXTIJGU FBTZNPUJPO
    XJTFNBOG FYUFOEFEGU
    WJNTNBMMT
    WJNTFFL
    IUUQUXJUUFSDPN-JOEB@QQTUBUVT

    View full-size slide

  27. ·ͱΊ
    • Vim ͷ f Ϛοϐϯάͱͦͷ֦ுϓϥάΠϯʹ
    ͍ͭͯ঺հͨ͠
    • ීஈ l ΍ w Λ࿈ଧͯ͠Ҡಈ͍ͯ͠Δਓ΋ɼੋ
    ඇҰ౓ࢼͯ͠Έͯ΄͍͠
    • ΧʔιϧͷԣҠಈ͸සൃ͢ΔͷͰɼ͜Ε͔Β
    ΋վળ͍͖͍ͯͨ͠

    View full-size slide