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

作ってわかる現代のVimのAutoComplete ~そしてVimConf2019へ~

作ってわかる現代のVimのAutoComplete ~そしてVimConf2019へ~

Toshikazu Ohashi

October 24, 2019
Tweet

More Decks by Toshikazu Ohashi

Other Decks in Programming

Transcript

  1. ࡞ͬͯΘ͔Δ
    ݱ୅ͷVimͷAutoComplete
    ~ͦͯ͠VimConf2019΁~
    gorilla.vim #9
    @lighttiger2505

    View full-size slide

  2. ࣗݾ঺հ
    • lighttiger2505(Toshikazu Ohashi)
    • αʔόαΠυΤϯδχΞ@iRidge
    • Vimྺ3೥͘Β͍
    • झຯ
    • CLIίϚϯυͱVim͍͡Γ

    View full-size slide

  3. AutoCompleteͯ͠·͔͢ʁ

    View full-size slide

  4. AutoComplete͕
    Ͳ͏ಈ͘ͷ͔ؾʹͳͬͯ
    ໷΋຾Ε·ͤΜ͔ʁ

    View full-size slide

  5. ΞδΣϯμ
    • [ΠϯτϩμΫγϣϯ] Auto Completeͱ͸ʁ
    • Auto CompleteΛ࡞ͬͯΈΑ͏
    • ݱ୅ͷVimͷAuto Completeͱ͸
    • એ఻

    View full-size slide

  6. AutoCompleteͱ͸ʁ

    View full-size slide

  7. AutoCompleteͱ͸
    • Ϣʔβ͕ΤσΟλʹೖྗͨ͠಺༰ʹԠͯ͡
    Ϛον͢ΔީิΛҰཡදࣔ͠ɺೖྗΛิॿ͢
    Δػೳ

    View full-size slide

  8. ͳ͓Vimʹ͸(खಈ)ิ׬͕͋Δ
    • `:help ins-completion`
    • `CTRL-X`Λى఺ʹ༷ʑͳछྨͷิ׬͕͋Δ
    • ϑΝΠϧ಺ͷΩʔϫʔυิ׬
    • ΦϜχิ׬

    View full-size slide

  9. VimConf2018Ͱൃද͞Εͨ
    ࢀߟʹͳΔεϥΠυ
    • https://speakerdeck.com/daisuzu/migrating-
    plugins-to-standard-features

    View full-size slide

  10. VimͷAutoComplete͸
    ϓϥάΠϯʹΑ࣮ͬͯݱ
    • ϓϥάΠϯͰ࣮ݱͰ͖Δͱ͍͏͜ͱ͸
    • Πίʔϧࣗ෼Ͱ࡞ΕΔ
    • ࡞ͬͯΈΑ͏

    View full-size slide

  11. AutoCompleteΛ
    ࡞ͬͯΈΑ͏

    View full-size slide

  12. ຊεςοϓͷΰʔϧ
    • lookcomplete.nvim

    View full-size slide

  13. શ̒εςοϓͰ࡞੒
    1. ࠷খͷิ׬
    2. ิ׬ͷڍಈΛௐ੔
    3. ࣗಈͰิ׬
    4. ӳ୯ޠΛิ׬
    5. ඇಉظͰิ׬ީิΛऔಘ
    6. ίʔϧόοΫͷνΣοΫ

    View full-size slide

  14. ຊσϞͰར༻͢Δίʔυ
    • GitHubͰެ։͞Ε͍ͯ·͢
    • https://github.com/lighttiger2505/
    lookcomplete.nvim

    View full-size slide

  15. 1. ࠷খͷิ׬
    • `:help complete`
    • ૊ࠐΈؔ਺Ͱิ׬ީิΛදࣔ

    View full-size slide

  16. 2. ิ׬ͷڍಈΛௐ੔
    • F5Λ͓ͨ͠ॠؒʹิ׬ީิ͕Πϯαʔτ
    • `:help completeopt`Λมߋ
    • ೖྗࡁΈ಺༰ʹॏෳͯ͠ૠೖ
    • `complete`ͷ`startcol`Λࢦఆ

    View full-size slide

  17. 3. ࣗಈͰิ׬
    • `TextChangedI`͝ͱʹpumΛߋ৽
    • `InsertEnter/Leave`ͰΧʔιϧߦΛอ࣋
    • ΠϯαʔτϞʔυʹͳͬͨॠؒʹදࣔ͞ΕΔ
    • ೖྗ͕ͳ͍৔߹ʹީิදࣔΛແޮԽ

    View full-size slide

  18. 4. ӳ୯ޠΛิ׬
    • lookίϚϯυ

    View full-size slide

  19. 5. ඇಉظͰิ׬ީิΛऔಘ
    • lookίϚϯυ࣮ߦதVim͕ϒϩοΫ
    • `:help jobstart(in NeoVim)`

    View full-size slide

  20. 6. ίʔϧόοΫͷνΣοΫ
    • lookίϚϯυ͕஗͔ͬͨ৔߹͓͔͠ͳڍಈ
    • lookίϚϯυͷίʔϧͨ͠ঢ়گ(Context)ͱ
    ิ׬දࣔͷঢ়گͱҰகͨ͠ͱ͖͚ͩදࣔ

    View full-size slide

  21. ࡞ͬͯΘ͔ͬͨAutoComplete
    • ΤσΟλͷ֩Ͱ͋ΔςΩετมߋΛϑοΫ͢
    ΔͷͰɺ΋ͷ͘͢͝ؾΛ͔ͭ͏
    • Ϣʔβ͕৺஍ྑ͍λΠϛϯάͰิ׬Λग़͢
    • ࡉ͔͍ௐ੔/νΣοΫॲཧ͕ෆՄܽ

    View full-size slide

  22. ࡞ͬͯΘ͔ͬͨAutoComplete
    • ςΩετฤूΛϒϩοΫͯ͠͸ͳΒͳ͍
    • ߴ଎ॲཧɺඇಉظॲཧ͕ඞਢ

    View full-size slide

  23. ݱ୅ͷVimͷ
    AutoCompleteͱ͸

    View full-size slide

  24. Αࣗ͠෼΋AutoComplete
    ϓϥΪϯΛ࡞Ζ͏ʂ
    • ͪΐͬͱ·ͬͯ
    • ଞͷAutoCompleteͱׯব
    • ϓϥάΠϯ͝ͱʹॏෳͨ͠ॲཧ
    • VimͷΠϕϯτϑοΫ/ίϯςΩετऔಘ/֤छνΣοΫ
    • ඇಉظιʔεऔಘͷࠔ೉͞
    • VimͱNeoVimͷ྆ରԠ͸ͭΒͦ͏...

    View full-size slide

  25. Completion Manager
    • ΠϕϯττϥοΩϯά͔Βิ׬ιʔεऔಘɺ
    ϙοϓΞοϓ੍ޚͳͲΛߦ͏ิ׬ϑϨʔϜϫʔ
    Ϋ

    View full-size slide

  26. Completion Manager
    • ίΞͷิ׬ػೳͱิ׬ιʔεΛΠϯλϑΣʔ
    εܦ༝Ͱૄ݁߹ʹ
    • ิ׬ιʔεΛϓϥάΠϯՄೳ͔ͭݸผ։ൃ͕
    Մೳ
    • ิ׬ιʔε։ൃऀ͸ΠϯλϑΣʔεʹै͑
    ͹ൺֱత؆୯ʹߴ଎ͳิ׬ͷԸܙΛड͚Δ

    View full-size slide

  27. Completion Managerͷߏ੒
    $PNQMFUJPO.BOBHFS
    4PVSDF
    ΠϕϯττϥοΩϯά
    ิ׬ιʔεґཔ
    ิ׬ީิදࣔ
    ิ׬ιʔεऔಘ
    ิ׬ιʔε
    ίʔϧόοΫ
    BTZOD
    DUY

    View full-size slide

  28. ۩ମྫ
    • deoplete.nvim
    • https://github.com/Shougo/deoplete.nvim/wiki/Completion-
    Sources
    • asyncomplete.vim
    • https://github.com/prabirshrestha/
    asyncomplete.vim#sources
    • coc.nvim
    • https://github.com/neoclide/coc.nvim#completion-sources

    View full-size slide

  29. Completion ManagerͰ
    շదͳੜ׆Λ

    View full-size slide

  30. Keynote speaker
    • Prabir Shrestha
    • asyncomplete.vim
    • lookcomplete.nvim͸΄΅͜Εͷ؆қ൛
    • async.vim
    • vim-lsp

    View full-size slide

  31. Speaker
    • Shougo(҉ࠇඒແԦ)
    • deoplete.nvim
    • Completion Manager࠷ڧͷ֦ுੑ
    • ϦϞʔτϓϥάΠϯͷ୅ද֨

    View full-size slide

  32. Keynote speaker
    • Justin M. Keyes
    • NeoVim
    • Ϧʔυϝϯςφʔ

    View full-size slide

  33. Lightning Talk
    • lighttiger2505
    • deoplete-vim-lsp
    • deoplete.vimͱvim-lspʹ͓ΜͿʹͩͬ͜

    View full-size slide

  34. Let's enjoy VimConf2019

    View full-size slide