about-neovim-0.4.0-floating-window

 about-neovim-0.4.0-floating-window

gorilla.vim #4 at Akatsuki on 2019/5/15

Dea1add99f4cf942792c0f185aa2f2fd?s=128

Linda_pp

May 15, 2019
Tweet

Transcript

  1. Neovim 0.4.0 ৽ػೳ ϑϩʔτ΢Οϯυ΢ʹ͍ͭͯ gorilla.vim #4, 2019/05/14

  2. About Me @Linda_pp @rhysd   ࠷ۙ͸ git-messenger.vim ͱ͔ͭͬͯ͘·͢

  3. ϑϩʔτ΢Οϯυ΢Λ࢖ͬͨ ϓϥάΠϯ  

  4. coc.nvim https://github.com/neoclide/coc.nvim  

  5. LanguageClient-neovim https://github.com/autozimu/LanguageClient- neovim  

  6. git-messenger.vim https://github.com/rhysd/git-messenger.vim  

  7. vim-iced https://github.com/liquidz/vim-iced  

  8. Neovim ϑϩʔτ΢Οϯυ΢ API  

  9. ϑϩʔτ΢Οϯυ΢ͱ͸ʁ λΠϧܕͰ͸ͳ͍ɼ৽͍͠ܗࣜͷ΢Οϯυ΢ɽ Neovim 0.4.0 Ͱ௥Ճ͞ΕΔ CSS Ͱ͍͏ position: absolute; ͳͲͷΑ͏

    ʹɼطଘͷ΢Οϯυ΢ͷ্ʹΦʔόʔϥοϓ ͨ͠΢Οϯυ΢Λͭ͘Δ͜ͱ͕Ͱ͖Δ  
  10.  

  11. call nvim_open_win(bufnr('%'), v:true, { \ 'relative': 'cursor', \ 'anchor': 'NW',

    \ 'row': 4, \ 'col': 4, \ 'width': 10, \ 'height': 10, \ })  
  12.  

  13. call nvim_open_win(bufnr('%'), v:true, { \ 'relative': 'cursor', \ 'anchor': 'NW',

    \ 'row': 4, \ 'col': 4, \ 'width': 10, \ 'height': 10, \ }) ࠷ॳʹ։͘όοϑΝ ΢Οϯυ΢Λ։͍ͨޙ ͦͷதʹΧʔιϧΛҠ ಈ͢Δ͔Ͳ͏͔ ϑϩʔτ΢Οϯυ΢Λ Ͳ͏։͔͘Λࢦఆ͢Δ $POpHࣙॻ ʢޙड़ʣ ։͍ͨϑϩʔτ΢Οϯυ΢ ͷ8JOEPX*%Λฦ͢  
  14. Config ࣙॻ Ωʔ ஋ આ໌ σϑΥϧτ஋ SFMBUJWF FEJUPS DVSTPS 

    XJOͷ͏ͪͷ͍ ͣΕ͔ ΢Οϯυ΢ͷى఺ ͷҐஔʢޙड़ʣ FEJUPS BODIPS /& /8 4&  48ͷ͍ͣΕ͔ ى఺ʹͯ͠ํ޲ͷ Ͳ͜ʹ΢Οϯυ΢ Λग़͔͢ʢޙड़ʣ /8 GPDVTBCMF CPPMFBO Ϣʔβ͕΢Οϯυ ΢಺ʹΧʔιϧΛ ҠಈͰ͖Δ͔ WUSVF FYUFSOBM CPPMFBO (6*ଆ͕ϑϩʔτ ΢Οϯυ΢Λදࣔ ͢Δ͔ WGBMTF  
  15. "relative" (row: 2, col: 3 ͷͱ͖ʣ • "editor" εΫϦʔϯ 

       • "cursor" Χʔιϧ   ΢Οϯυ΢෼ׂ • "relative" ˞ର৅΢Οϯυ΢͸ XJOΩʔͰࢦఆ͢Δ "row": 2, "col": 3 ͷͱ͖ ϑϩʔτ΢Οϯυ΢  
  16. "anchor" "relative": "cursor", "row": 0, "col": 0 ͷͱ͖ Χʔιϧ •

    "NE" • "NW" • "SW" • "SE" Χʔιϧ Χʔιϧ Χʔιϧ  
  17. ։͘Ҏ֎ͷૢ࡞ • ด͡Δ → ී௨ͷ Vim ͷ΢Οϯυ΢ͱಉ ͡ɽ:close ΍ :wincmd

    c ΍ nvim_close_win() ͳͲ޷͖ʹด͡ΒΕΔ • αΠζมߋɾҠಈ → nvim_win_set_config(win_id, config) Ͱίϯ ϑΟάࣙॻΛηοτ͠ͳ͓͢͜ͱͰ൓ө͞ΕΔ  
  18. ϑϩʔτ΢Οϯυ΢ͷ࣮૷ • ࣮૷ऀɿ@bfredl ͞Μ • ଍ֻ͚໿2೥͔͚࣮ͯ૷ 1. ϑϩʔτ΢Οϯυ΢ͷ࢓૊ΈΛ࣮૷ɽnvim_open_win() ͳͲͰϓϥάΠϯ͔Β ΋ࣗ༝ʹ࢖͑ΔΑ͏ʹ͢Δʢ#6619ʣ

    2. ૊ΈࠐΈͷิ׬΢Οϯυ΢Λϑϩʔτ΢Οϯυ΢Ͱ࠶࣮૷͠ɼϑϦοΧϦϯά Λܰݮ͢Δʢ#9530ʣ 3. ίϚϯυϥΠϯϞʔυͷϙοϓΞοϓิ׬ wildoptions=pum Λ࣮૷ʢ#9607ʣ 4. ॏͳ͍ͬͯΔ΢Οϯυ΢ͷ৭ΛϒϨϯυ͢Δػೳͷ࣮૷ͳͲվળதʢ#9923ʣ • ϕʔεͱͳΔ࢓૊ΈΛ࣮૷͠ɼͦΕΛ࢖ͬͯ಺෦ΛϦϑΝΫλϦϯάɾϢʔβ͔Β΋ ར༻Ͱ͖ΔΑ͏ʹ͍ͯ͠Δ  
  19. ϑϩʔτ΢Οϯυ΢͸Ͳ͕͜ ྑ͍ͷ͔  

  20. ৽نػೳΛ΢Οϯυ΢ͷϨΠΞ΢τͷΈʹߜ Γɼैདྷͷ Vim ΢Οϯυ΢ͱಉ౳ʹ࢖͑Δ • ΢Οϯυ΢ͷத਎͸ී௨ͷ Vim ͷόοϑΝ • ৭Λ෇͚͚ͨΕ͹ߏจϋΠϥΠτΛॻ͍ͯ

    filetype Λ΢Οϯυ΢಺Ͱηοτ͢Ε͹ྑ͍ • ดͨ͡ΓΧʔιϧҠಈͨ͠Γ΋ :wincmd ͳͲ ͷैདྷͷ΍ΓํͰͰ͖Δ  
  21. ଥڠ͠ͳ͍࣮૷ • ΢Οϯυ΢ͷαΠζ͸ 1x1 ͔ΒࢦఆͰ͖Δ • ͍ͭ͘Ͱ΋ੜ੒Ͱ͖Δʢz-index ͸ޙউͪʣ • ϑϩʔτ΢Οϯυ΢͕εΫϦʔϯ͔Β͸Έग़

    Δ࣌͸ࣗಈͰௐ੔ͯ͘͠ΕΔͷͰϓϥάΠϯ ࡞ऀ͸ؾʹ͠ͳͯ͘ྑ͍  
  22. ϓϥάΠϯ࡞ऀ͸͜ΕΛ౔୆ʹ༷ʑͳ UI ΛߏஙͰ͖Δ • ΠϯλϥΫςΟϒͳϙοϓΞοϓϝχϡʔ • ิ׬ϝχϡʔࣗ࡞ • υΩϡϝϯτͳͲͷϓϨϏϡʔ΢Οϯυ΢΍πʔϧνοϓ •

    ςΩετϥϕϧʢEasyMotion ͷΑ͏ͳʣ • ௨஌ • ...  
  23. ϑϩʔτ΢Οϯυ΢஫ҙ఺ • ΢Οϯυ΢Λ࢖͍ऴΘͬͨΒϓϥάΠϯଆͰ࣮֬ʹด͡Δɽಛʹ "enter": v:false ʹ͢ΔͱϢʔβ͔Β͸༰қʹด͡ΒΕͳ͍ • git-messenger.vim Ͱ͸όοϑΝ಺ͰΧʔιϧ͕ಈ͍ͨΓ৽͍͠΢Οϯυ΢ʹ Ҡಈ͢ΔλΠϛϯάΛϑοΫͯ͠ด͍ͯ͡Δ

    • σϑΥϧτͰ NormalFloat ͱ͍͏ϋΠϥΠτ͕ Normal ͷ୅ΘΓʹ࢖ΘΕΔʢม ߋ͢Δʹ͸ 'winhightlight' ΦϓγϣϯΛ࢖͏ʣ • ίϯςϯπ͕΢Οϯυ΢಺ʹऩ·ΔΑ͏ʹ͢Δɽऩ·Γ͖Βͳ͍৔߹͸Ϣʔβ͕ εΫϩʔϧͰ͖ΔΑ͏ʹ͢ΔͳͲ޻෉͢Δ • Vim ͱͷޓ׵ੑΛอͭʹ͸ɼVim Ͱ͸ϓϨϏϡʔ΢Οϯυ΢Λ࢖͏Α͏ʹ͢Δͱ ͏·͍͘͘৔߹͕͋Δʢgit-messenger.vimʣ  
  24. ·ͱΊ • ϑϩʔτ΢Οϯυ΢͸ඇৗʹ 'ے͕ྑ͍' ػೳ • ϓϥάΠϯ࡞ऀ͸ࠓ·Ͱʹ͸࣮ݱ͕ࠔ೉ͩͬ ͨ UI ΛߏஙͰ͖Δ

    • Neovim ϓϥάΠϯΛ͍ͭͬͯ͘Δํ͸ੋඇར ༻Λݕ౼ͯ͠Έ͍ͯͩ͘͞