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

さよならhelm、ようこそivy/counsel

 さよならhelm、ようこそivy/counsel

helm から ivy に移行しました。その記録です。
(設定集) https://gist.github.com/takaxp/86158fe74b8268843571c42b48a4336c

2f8382165a55ae49e97fb193a7f699f2?s=128

Takaaki ISHIKAWA

July 24, 2019
Tweet

Transcript

  1. ͞ΑͳΒ Helmɺ Α͏ͦ͜ Ivy/Counsel @ TA K A X P

    P R E S E N T S 2019-07-24 at pixiv
  2. ࣗ ݾ ঺ հ • Takaaki Ishikawa • Org mode

    extreme user • Using Emacs more than 15 years Twitter: @takaxp ! 2
  3. ຊ ೔ ͷ ͓ ࿩ ͸ ʁ • Helm ͔Β

    Ivy/Counsel ΁Ҡߦ͓ͨ͠࿩ • ಘΒΕͨ஌ݟ • ༏ྼΑΓ΋ɺivy-mode ͔Θ͍͍Α ※ IvyͷΞΠίϯͰ͸͋Γ·ͤΜ ! 3
  4. ର ৅ ऀ ͸ ʁ • ؤͳʹิ׬γεςϜΛ࢖Θͳ͍ɺ௝͍͠ਓ • Helm Λ࢖͏͕ɺ৽͍͠ิ׬γεςϜΛࢼ͍ͨ͠ਓ

    • Ivy ͕ྑ͍Β͍͠ͱᷚͰฉ͕͘ɺࣗ෼Ͱࢼ͢ͷ͸໘౗ ͰɺͱΓ͋͑ͣ·ͱ·ͬͨҠߦ࿩Λฉ͖͍ͨਓ ! 4
  5. Ͳ Μ ͳ ײ ͡ ʹ ͳΔʁ ʢ ྫ 1

    ʣ ※ IvyͷΞΠίϯͰ͸͋Γ·ͤΜ ! 5
  6. Ͳ Μ ͳ ײ ͡ ʹ ͳΔʁ ʢ ྫ 1

    ɾ I V Y ʣ ! 6
  7. Ͳ Μ ͳ ײ ͡ ͩ ͬ ͨ ʁ ʢ

    ྫ 1 ʣ ※ HelmͷΞΠίϯͰ͢ ! 7
  8. Ͳ Μ ͳ ײ ͡ ͩ ͬ ͨ ʁ ʢ

    ྫ 1 ɾ H E L M ʣ ! 8
  9. ൺ ֱ ͢ Δ ͱ ʁ ʢ ྫ 1 ʣ

    ! 9
  10. Ͳ Μ ͳ ײ ͡ ʹ ͳΔʁ ʢ ྫ 2

    ʣ ※ IvyͷΞΠίϯͰ͸͋Γ·ͤΜ ! 10
  11. Ͳ Μ ͳ ײ ͡ ʹ ͳΔʁ ʢ ྫ 2

    ɾ I V Y ʣ ! 11
  12. Ͳ Μ ͳ ײ ͡ ͩ ͬ ͨ ʁ ʢ

    ྫ 2 ʣ ※ HelmͷΞΠίϯͰ͢ ! 12
  13. Ͳ Μ ͳ ײ ͡ ͩ ͬ ͨ ʁ ʢ

    ྫ 2 ɾ H E L M ʣ ! 13
  14. ݟ ͨ ໨ ͕ ͔ ͳ Γ ҧ ͬ ͨ

    … ※ ͜΍ͭͷ໊͸
 εϫΠύʔ ೖྗI/FͷҐஔ ީิϦετͷҐஔ ͓ۙ͘ͷwindowʹ ৗʹϛχόοϑΝʹ ! 14
  15. ݟ ͨ ໨ ͷ ྑ ͞ ͕ ໨ ཱ ͭ

    Ͷ ※ ͜΍ͭͷ໊͸
 εϫΠύʔ ʮ͔Θ͍͍ΞΠίϯʯͱʮબ΂ΔදࣔҐஔʯ see https://github.com/tumashu/ivy-posframe ! 15
  16. I V Y ͷ த ৺ ͸ I V Y-

    R E A D • prompt • collection • action • caller • sort etc… ! 16
  17. ͡ Ό ͊ C O U N S E L

    ͸ ʁ • ivy-read Λ࢖ͬͨϓϦηοτؔ਺ͷू·Γ • Emacs ίϚϯυΛஔ͖׵͑Δ • Git, Grep, System৘ใ΋ର৅ • Ұ෦ɺଞͷύοέʔδͷؔ਺΋֦ு
 ʢorg-tags, org-attach, org-capture, package.el...) ! 17
  18. ͡ Ό ͊ C O U N S E L

    ͸ ʁ E M A C S C O M M A N D C O U N S E L execute-extended-command counsel-M-x describe-bindings counsel-descbinds describe-function counsel-describe-function describe-variable counsel-describe-variable list-faces-display counsel-faces find-file counsel-find-file find-library counsel-find-library load-theme counsel-load-theme yank-pop counsel-yank-pop pop-to-mark-command counsel-mark-ring bookmark-jump counsel-bookmark see https://github.com/abo-abo/swiper ϓϦηοτ͕ॆ࣮͍ͯ͠ΔͷͰɺॳ৺ऀʹ΍͍͞͠ɻ ͓ͦΒ͘ɺ൒෼͕όϑΝϦϯɻ ! 18
  19. I V Y / C O U N S E

    L ͱ ه ड़ ͢ Δ ੋ ඇ • helm ΍ anything ͱͷରൺͷதͰɺivy/counsel ͱද͢ ͜ͱ͕͋Δ͚Ͳ΋… • ivy ͍҃͸ ivy-mode Ͱྑ͍ͷͰ͸ʁ ͸ ʁ ! 19
  20. ͋ ͱ S W I P E R ͸ ʁ

    • ͬ͘͟Γͱɺhelm-swoop Ͱ͢ɻ ※ ͜΍ͭͷ໊͸
 εϫΠύʔ ! 20
  21. Π ϯε τ ʔϧ • ύοέʔδ؅ཧܦ༝ͳΒɺcounsel.el ΛೖΕΔɻ • gitܦ༝ͳΒɺswiper Λ

    clone ͢Δɻ
 https://github.com/abo-abo/swiper ! 21
  22. ج ຊ ઃ ఆ ! 22

  23. H E L M 2 I V Y ! 23

  24. I V Y ͷ ྲྀ ّ ( 1 ) •

    helm ͷ࣌͸ɺ<TAB> Ͱ action ΛબΜͩɻ • ivy ʹೖ໳͢ΔͳΒɺM-o Λ࢖͏΂͠ɻ ! 24
  25. I V Y ͷ ྲྀ ّ ( 2 ) •

    ީิϦετͷߏ੒͸γϯϓϧʹ flyspell-correct-helm.el (<f7> save <ENT>) flyspell-correct-ivy.el (<f7> M-o s <ENT>) ! 25
  26. I V Y ͷ ྲྀ ّ ( 3 ) M-o

    (ivy-dispatching-done-hydra) C-o (hydra-ivy/body) • ivyͷߜΓࠐΈதʹݺͼग़ͤΔػೳ ! 26
  27. ͦ ͏ ͍ ͑ ͹ ɺ ɺ ɺ • hydra?

    ! 27
  28. T H A N K S T O A B

    O - A B O see https://github.com/abo-abo ! 28
  29. Χ ε λ ϚΠ ζ ͢ Δ 1. ޷Έͷ഑৭ 2.

    ީิϦετͷฒͼସ͑ɺཤྺͷར༻ 3. eldoc ʹ͓໧Γ͍ͨͩ͘ 4. all-the-icons Ͱݟ΍͘͢ 5. ϓϩϯϓτΛϋοΫ 6. νΣʔϯɾΞΫγϣϯ ! 29
  30. σ ϑ Υϧ τ ͷ ഑ ৭ • ͔ͳΓϑΝϯΩʔ !

    30 1. ޷Έͷ഑৭
  31. ഑ ৭ ͸ ͠ ͬ ͔ Γ Χ ε λ

    ϚΠ ζ ͢ Δ • ໌ࣔతʹઃఆ͠ͳ͍ͱɺσϑΥϧτʹҾͬுΒΕ·͢ɻ • ivy-current-match • ivy-minibuffer-match-face-1 • ivy-minibuffer-match-face-2 • ivy-minibuffer-match-face-3 • ivy-minibuffer-match-face-4 ! 31 1. ޷Έͷ഑৭
  32. ഑ ৭ ࣄ ྫ ! 32 1. ޷Έͷ഑৭

  33. ద ༻ ݁ Ռ • ͨͩ͠ɺivy-re-builders-alist ͷ஋ʹԠͯ͡ίϚϯυ͝ͱʹҟͳΔදࣔ݁ՌʹͳΔɻ ! 33 1.

    ޷Έͷ഑৭
  34. 2 . ީ ิ Ϧε τ ͷ ฒ ͼ ସ

    ͑ ɺ ཤ ྺ ͷ ར ༻ • ίϚϯυ͝ͱʹࡉ੍͔͘ޚͰ͖Δ • ivy-sort-functions-alist • ivy-sort-matches-functions-alist • ivy-re-builders-alist • smex.el, savehist.el (~/.emacs.d/history), session.el ͱͷ૊Έ߹Θͤ ٯʹݴ͑͹ɺίϚϯυ͝ͱʹ੍ޚ͕ඞཁ ! 34
  35. Α Γ ଟ ͘ͷ ί Ϛ ϯ υ ʹ ಉ

    ͡ ઃ ఆ Λ • prescient.el (with ivy-prescient.el) • ಡΈࠐΜͰ์ஔ͓͚ͯ͠͹Α͍ • ivy-read Λ࢖͏ͨͼʹɺར༻ཤྺΛऔΓɺอଘ • ಠࣗͷΞϧΰϦζϜͰɺબ୒ީิΛ࠷దԽ • Πχγϟϧೖྗ͕Մೳ
 ʢe.g. M-x fap Ͱ find-file-at-point ͕ώοτ͢Δ!ʣ • (company ʹ΋࢖͑Δ) ! 35 2. ฒͼɾཤྺ
  36. P R E S C I E N T. E

    L ! 36 see https://github.com/raxod502/prescient.el 2. ฒͼɾཤྺ
  37. Χ ε λ ϚΠ ζ ͱ ཹ ҙ ఺ •

    prescient.el ͕ѻ͏ ivy-read ͸ɺ:caller ͕ઃఆ͞Εͯ ͍Δ৔߹ͷΈ • :sort nil ͔ :sort ͕ະઃఆͷ ivy-read ͸ɺivy-prescient- sort-commands ʹίϚϯυΛ௥Ճ͢Ε͹Α͍ • ౷ܭσʔλͷอଘ͕ɺkill-emacs-hook ʹඥ෇͍͍ͯΔ • prescient-aggressive-file-save Λઃఆ͢Ε͹OK ! 37 2. ฒͼɾཤྺ
  38. Χ ε λ ϚΠ ζ ྫ ! 38 2. ฒͼɾཤྺ

  39. M - X ͩ ͚ Πχγ ϟϧ ೖ ྗ ͠

    ͨ ͍ • counsel-M-x ʹ ivy-prescient-re-builder Λ୅ೖ • ϚΠφʔϞʔυΛ༗ޮԽޙɺivy-re-builders-alist ͷσϑΥϧτ஋Λ೚ҙͷ஋ʹ ໭͢ʢivy ͷσϑΥϧτ͸ ivy--regex-ignore-order Ͱ͸ͳ͘ ivy--regex-plusʣ ! 39
  40. ͦ ͏ ͍ ͑ ͹ ɺ ɺ ɺ • straight.el?

    ! 40 2. ฒͼɾཤྺ
  41. T H A N K S T O R A

    X O D 5 0 2 ! 41 see https://github.com/raxod502 2. ฒͼɾཤྺ
  42. 3 . E L D O C ʹ ͓ ໧

    Γ ͍ ͨ ͩ ͘ • eldoc-print-after-edit ͷઃఆͰ͸ෆे෼ ! 42
  43. 4 . A L L - T H E -

    I C O N S Ͱ ݟ ΍ ͘͢ • ivy-rich.el • all-the-icons.el ʢivy-richͱͷڞଘ͸ݫͦ͠͏…ʣ ! 43 all-the-icons.el Λ࢖͍͜ͳͤΔ͔͸ผ໰୊ɽώϯτ͸ font-lockɽ
  44. 5 . ϓ ϩ ϯ ϓ τ ͷ ϋο Ϋ

    • σϑΥϧτͩͱ͚ͦͬͳ͍ • ivy-count-format ͷΧελϚΠζ͸Մೳʢe.g. [123/6837] M-xʣ • “^” ͷσϑΥϧτ͸ɺivy-initial-inputs-alist Ͱ੍ޚͰ͖Δ • ϞʔυϥΠϯෆཁ೿ʹ͸ɺ΢Οϯυ΢ڥք͕ͳ͘ਏ͍ • ͦ͏ͩɺϋοΫ͠Α͏ʂ ! 44
  45. I V Y- - I N S E R T-

    P R O M P T • ivy--insert-prompt Λ advice ͢Δ ! 45 5. ϓϩϯϓτͷϋοΫ
  46. 6 . ν Σ ʔϯ ɾ ΞΫ γ ϣ ϯ

    • ivy ͷྲّྀʹै͏ͳΒɺM-o Λ׆༻͢΂͖ • ߜΓࠐΈதʹɺߜΓࠐΈ৚݅Λม͑ͨΓɺผͳίϚ ϯυʹ઀ଓͰ͖Δɻ counsel-ag counsel-ag M-o r ~/a/b/c ~/a 2্ͭͷ֊૚͔Β શจΛ ࠶ݕࡧ͍ͨ͠ͳ ͪɺཤྺʹ ೖͬͯͳ͍Α ͋ͷϑΝΠϧ counsel-recentf counsel-fzf M-o z ! 46
  47. ν Σ ʔϯ ɾ ΞΫ γ ϣ ϯ ͷ ઃ

    ఆ ํ ๏ • action༻ͷؔ਺Λॻ͍ͯɺivy-add-actions Ͱ௥Ճɻ ! 47 6. νΣʔϯɾΞΫγϣϯ
  48. ݕ ࡧ Ϋ Τ Ϧ ͸ ͦ ͷ · ·

    Ͱɺ ଟ ஈ ઀ ଓ counsel-projectile-find-file M-o z ~/a/b/c counsel-fzf ~/ ͋Εɺݟ͔ͭΒͳ͍ ൣғ޿͗͢ɺॏ͍ M-o r counsel-fzf ~/a/b ͋ͬͨʂ ! 48 6. νΣʔϯɾΞΫγϣϯ
  49. ʮ ͋ Ε ɺ ݟ ͭ ͔ Β ͳ ͍

    ʯ Λ ิ ॿ • ώοτ͠ͳ͔ͬͨΒɺҰ౓͚ͩɺcounsel-fzf ʹࣗಈ༠ಋ • ivy--insert-prompt ΛϋοΫ ͋Εɺݟ͔ͭΒͳ͍ ! 49 6. νΣʔϯɾΞΫγϣϯ
  50. · ͱ Ί • helm ͔Β ivy ʹҠߦͯ͠ಘΒΕͨ஌ݟΛ͓࿩͠·ͨ͠ • ivy͸ɺجຊతʹγϯϓϧͰ࢖͍΍͍͢Ͱ͢

    • helm ͔Β͸͍͑΍ʂͰҠߦͯ͠΋େৎ෉Ͱ͠ΐ͏ • ઃఆͷৄࡉ΍ɺͦͷଞͷϋοΫ͸ޙ೔Qiitaʹެ։͠·͢ • ݒ೦͕͋Δͱ͢Ε͹ɺਓؾύοέʔδͷΦϨΦϨ ivy-read ͕ཚཱ͢Δ͜ͱ • ivy-read ΛҰݩԽ͢ΔϦϙδτϦ͕͋ΔͱɺօͷͨΊ͔΋ ! 50 https://gist.github.com/takaxp/ 86158fe74b8268843571c42b48a4336c ઃఆू: ࣭໰౳: https://twitter.com/takaxp