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

GUI is not fast enough!! (GUIには速さが足りないっ!!)

GUI is not fast enough!! (GUIには速さが足りないっ!!)

社内勉強会でCUIについて話す時用の資料

Toshikazu Ohashi

September 23, 2017
Tweet

More Decks by Toshikazu Ohashi

Other Decks in Programming

Transcript

  1. GUI is not fast enough!!
    Toshikazu Ohashi

    View full-size slide

  2. About me
    • iRidge No.1 Vimmer(1st among 1
    people)
    • My kindle library 6000 over
    • color schema of this slide is
    [molokai]

    View full-size slide

  3. ӳޠ͸͜͜·Ͱ

    View full-size slide

  4. ൃදͷલʹ֬ೝͰ͢
    • օ͞Μ͸ීஈCLIΛ࢖ͬͯ·͔͢ʁ
    1.9ׂํCLIΛ৮ͬͯΔ
    2.ඞཁ͕͋Ε͹CLI΋࢓ํ͕ͳ͘৮Δ
    3.CLIͳͲݟͨ͘΋৮Γͨ͘΋ͳ͍ɻͿͬͪΌ
    ͚ؾ࣋ͪѱ͍

    View full-size slide

  5. ΞδΣϯμ
    • 1. ͳΜͰCLIͳΜͯ࢖ͬͯΜͷʁϚκͳͷʁ
    • 2. ࠓ೔͔ΒͰ͖ΔCLIվળTIPS
    • 2-1. ڧྗͳγΣϧΛ࢖͓͏
    • 2-2. ௥ՃίϚϯυ/ϓϥάΠϯͰշదͳ࢓ࣄΛ
    • 2-3. ϙʔλϓϧͳ؀ڥͰ͍ͭͰ΋ύϫϑϧ
    • 3. ·ͱΊ

    View full-size slide

  6. • 1. ͳΜͰCLIͳΜͯ࢖ͬͯΜͷʁϚκͳͷʁ
    • 2. ࠓ೔͔ΒͰ͖ΔCLIվળTIPS
    • 2-1. ڧྗͳγΣϧΛ࢖͓͏
    • 2-2. ௥ՃίϚϯυ/ϓϥάΠϯͰշదͳ࢓ࣄΛ
    • 2-3. ϙʔλϓϧͳ؀ڥͰ͍ͭͰ΋ύϫϑϧ
    • 3. ·ͱΊ

    View full-size slide

  7. ͦ΋ͦ΋લఏ͕ҧ͏
    • GUI͸୭Ͱ΋؆୯ʹ࢖͑ΔΑ͏ʹɺϢʔβʹ༩͑
    Δબ୒ࢶΛͱͯ΋গͳ͘ɺڧྗͳ΋ͷʹ͢Δ
    • CLI(ͱ͍͏͔UNIX)͸ͦ΋ͦ΋ॳ৺ऀΛड͚ೖ
    ΕΔͭ΋ΓͳͲͳ͍ɻʮԿΛ͍ͯ͠Δ͔Θ͔Β
    ͳ͍ͷͳΒɺ͜͜ʹ͍Δ΂͖Ͱ͸ͳ͍ʯ͕ઃܭ
    ࢥ૝

    View full-size slide

  8. ͳΜͰCLIͳΜͯ࢖ͬͯΜͷʁ
    • CLI͸৭ʑ଎͍
    • ىಈ͕଎͍
    • Ϩεϙϯε͕଎͍
    • શ෦CLIͰ΍Ε͹੾Γସ͑ͳ͠
    • GIT΋DBૢ࡞΋ςετΤσΟοτ΋͢΂ͯ̍ը໘
    • ڴҖͷ֦ுੑ
    • GUIͰͰ͖ͯCLIʹͰ͖ͳ͍͜ͱ͸ͳ͍

    View full-size slide

  9. CLI͸ࢥߟΛૢ࡞ʹ௚݁͢Δ
    • GUIͳΒ
    • ૢ࡞͍ͨͬ͠!
    • ରԠ͢Διϑτ΢ΣΞΛىಈ͢Δɻ·ͨ͸΢Οϯυ΢੾Γସ͑
    • ϝχϡʔΛ୳͢
    • ૢ࡞Λ࣮ߦ͢Δ
    • CLIͳΒ
    • ૢ࡞͍ͨͬ͠!
    • ରԠ͢ΔίϚϯυΛ࣮ߦ͢Δ

    View full-size slide

  10. σϝϦοτ
    • ֶशίετ͕ߴ͍…ͨͩͻͨ͢Βʹߴ͍
    • ίϚϯυΛ֮͑ͳ͍ͱԿ΋Ͱ͖ͳ͍
    • ઃఆϑΝΠϧ͕΋͸΍ࠇຐज़
    • shell scriptΛ௕จॻ͘ͱՄಡੑ͕͑Β͍͜ͱʹ
    • தಟੑ͕ߴ͍
    • Կނ͔ೋݴ໨ʹ͸VimͬͯݴͬͯΔɻφϯσ

    View full-size slide

  11. ಥવͰ͕͢
    ͜͜ͰΫΠζͰ͢

    View full-size slide

  12. Q.͜ͷ਺ࣈ͸ͳΜͰ͠ΐ͏͔ʁ
    2517

    View full-size slide

  13. A.CLIͷઃఆߦ਺
    (2017/09/23࣌఺)

    View full-size slide

  14. Ͳ͏ͯ͜͠͏ͳΔ·Ͱ์͓͍ͬͯͨΜͩ
    • લ৬͸൒෼Excel৬ਓ
    • GeekͬΆ͍͜ͱΛͨͯ͘͠3೥ҐCLIΛ͍͡Δ
    • ͜ͷ࣌఺ͰઃఆϑΝΠϧʹ+200ίϛοτ
    • ϑϦʔμϜͳ؀ڥͳͷͰCLIͱVimͰ൒೥࢓ࣄ͢Δ
    • ͜ͷ࣌఺ͰઃఆϑΝΠϧʹ+200ίϛοτ
    • ࣾೋපΛ͜͡ΒͤΔ

    View full-size slide

  15. • 1. ͳΜͰCLIͳΜͯ࢖ͬͯΜͷʁϚκͳͷʁ
    • 2. ࠓ೔͔ΒͰ͖ΔCLIվળTIPS
    • 2-1. ڧྗͳγΣϧΛ࢖͓͏
    • 2-2. ௥ՃίϚϯυ/ϓϥάΠϯͰշదͳ࢓ࣄΛ
    • 2-3. ϙʔλϓϧͳ؀ڥͰ͍ͭͰ΋ύϫϑϧ
    • 3. ·ͱΊ

    View full-size slide

  16. CLI͸ࣗ෼ͷ෦԰ͷΑ͏ͳ΋ͷͰ͋Δ
    • ๛͔ͳੜ׆ͷͨΊɺࣗવͱՈ۩ͷ഑ஔΛߟ͑ͨΓɺ
    ศརͳಓ۩΍Ոి੡඼Λἧ͑ͨΓ͢Δͷָ͍ͬͯ͠
    • CLI΋ಉ͡ɻ๛͔ͳੜ׆ͷͨΊͷΧελϚΠζ
    • Α͘࢖͏ίϚϯυʹΤΠϦΞεషΔ
    • ΑΓศརʹ࢖͏ͨΊʹ৽͍͠ϓϥάΠϯ΍πʔ
    ϧΛἧ͑Δ

    View full-size slide

  17. ͪΐͬͱͣͭͰ͍͍
    • Small is beautiful.(খ͍͞΋ͷ͸ඒ͍͠)
    • CLIͷ͍͍ͱ͜Ζ͸೔ʑͷͪΐͬͱͨ͠ෆຬΛ
    ঃʑʹվળͰ͖Δ͜ͱ
    • ͨͬͨҰߦͷઃఆ͕ܶతͳվળΛ΋ͨΒ͢

    View full-size slide

  18. ·ͣ͜͏͍͏λʔϛφϧͱ͸
    Φαϥό͠·͠ΐ͏

    View full-size slide

  19. • 1. ͳΜͰCLIͳΜͯ࢖ͬͯΜͷʁϚκͳͷʁ
    • 2. ࠓ೔͔ΒͰ͖ΔCLIվળTIPS
    • 2-1. ڧྗͳγΣϧΛ࢖͓͏
    • 2-2. ௥ՃίϚϯυ/ϓϥάΠϯͰշదͳ࢓ࣄΛ
    • 2-3. ϙʔλϓϧͳ؀ڥͰ͍ͭͰ΋ύϫϑϧ
    • 3. ·ͱΊ

    View full-size slide

  20. ZSH
    • ͭΑ͍Shell
    • ิ׬͕௒ศརʹͳΔ
    • ϓϥάΠϯʹΑΔΧελϚΠζੑ͕ߴ͍
    • ࢀߟ[׽ͷZSH](http://news.mynavi.jp/
    column/zsh/)

    View full-size slide

  21. ิ׬
    • σϑΥϧτͷิ׬͕طʹศར
    • BashͷΑ͏ʹҰҙͰͳͯ͘΋ิ׬͢Δ
    • GitͷαϒίϚϯυ΍ϑϥά·Ͱิ׬͢Δ

    View full-size slide

  22. ώετϦ
    • Ұ౓ଧͪࠐΜͩίϚϯυͳͧೋ౓΋ଧͭ΋ͷ͔
    • ͱʹ͔͘ώετϦΛͨͲΔػೳ͕ͭΑ͍

    View full-size slide

  23. ϓϩϯϓτ
    • ϓϩϯϓτΛ͍͡ΔͱͦΕ͚ͩͰޮ཰্͕͕Δ
    • ΧϨϯτσΟϨΫτϦ͸Ͳ͔͜
    • ݱࡏGitͷϒϥϯν͸Կ͔
    • Vim͕όοΫάϥ΢ϯυͰಈ͍͍ͯΔ͔

    View full-size slide

  24. # ݱࡏͷϒϥϯν
    ͳ͓εςʔλεʹΑΓࡾ৭ʹมԽ
    ੺: staged͋Γ
    ԫ: change͋Γ
    ྘: changeͳ͠
    εςʔλεදࣔ͸ॏ͗ͯ͢੾ͬͨ

    View full-size slide

  25. # Vimͷδϣϒ
    όοΫάϥ΢ϯυͰVim͕ಈ͍͍ͯͨΒVimͱදࣔ

    View full-size slide

  26. # Line EditorͷϞʔυ
    Vimͱಉ༷ͷૢ࡞͕Ͱ͖ΔΑ͏ʹΧελϚΠζ͍ͯ͠ΔͷͰϞʔυ͕͋Δ
    ࠓͷϞʔυΛ֬ೝͰ͖Δ

    View full-size slide

  27. # ΧϨϯτσΟϨΫτϦ

    View full-size slide

  28. • 1. ͳΜͰCLIͳΜͯ࢖ͬͯΜͷʁϚκͳͷʁ
    • 2. ࠓ೔͔ΒͰ͖ΔCLIվળTIPS
    • 2-1. ڧྗͳγΣϧΛ࢖͓͏
    • 2-2. ௥ՃίϚϯυ/ϓϥάΠϯͰշదͳ࢓ࣄΛ
    • 2-3. ϙʔλϓϧͳ؀ڥͰ͍ͭͰ΋ύϫϑϧ
    • 3. ·ͱΊ

    View full-size slide

  29. ͓͠ͳ͕͖
    • zsh-syntax-highlighting
    • zsh-autosuggestions
    • zsh-completions
    • fzf
    • enhancd
    • ghq
    • tig

    View full-size slide

  30. zsh-syntax-highlighting
    • syntax highlight is GOT !!
    • γϯλοΫε͕ద༻͞ΕΔɻͨͩͦΕ͚ͩ
    • ͦΕ͚ͩͰޡૢ࡞͕֨ஈʹݮΔ

    View full-size slide

  31. zsh-autosuggestions
    • ώετϦ͕ߋʹڧྗʹͳΔ
    • ώετϦͷ಺༰ΛࣗಈతʹαδΣετ͢Δ
    • ίϚϯυଧ伴ˠώετϦద༻ͷ൑அ͕௒଎ʹ
    ͳΔ

    View full-size slide

  32. ·ͱΊͯDEMO

    View full-size slide

  33. fzf
    • fuzzy matcher(;͊͡ʔ·ͬͪΌʔ)ͱ͔͍ΘΕΔ΍
    ͭɻଟ͘ͷྨࣅπʔϧ͕੾᛭ୖຏ͢ΔCLIπʔϧͷҰେ
    δϟϯϧͰ͋Δɻ΄͔ʹ͸pecoͱ͔͋Δ
    • stdinΛϦετදࣔ͢Δ
    • ೖྗΩʔϫʔυͰϚονϯά͢Δ
    • બ୒߲ͨ͠໨Λstdoutʹ౉͢
    • ͨͩͦΕ͚ͩͷπʔϧɻ߇͑ΊʹݴͬͯGOT

    View full-size slide

  34. fzfͭΑ͍
    • ͓Θ͔Γ͍͚ͨͩͨͩΖ͏͔ʁ
    • fzf͸CLIૢ࡞ʹ͓͚Δબ୒ͷखॱΛݶΓͳ͘ߴ଎Խ͢Δɻ
    • Ұཡදࣔ(ex:ϒϥϯνҰཡදࣔ)
    • ୳͢(ex:େྔͷϒϥϯν͔Β໨Ͱݟ͕ͯ͢͞)
    • ૢ࡞ର৅ʹίϚϯυ࣮ߦ(ex:ϒϥϯνΛνΣοΫΞ΢τ)
    • ͔͠΋ΧελϚΠζ࣍ୈͰԿʹͰ΋ద༻Մೳ

    View full-size slide

  35. enhancd
    • CLIૢ࡞ʹ͓͍ͯ࠷΋࣮ߦ͞ΕΔίϚϯυͱ͸
    [cd]ͳ͍͠[ls]Ͱ͋Δɻҟ࿦͸ೝΊͳ͍
    • [cd]ͷޮ཰Խ==CLIͷޮ཰Խ
    • લड़ͨ͠fzfΛ׆༻ํ๏ͷதͰ΋࠷΋༗༻ͳ΋
    ͷͷҰͭ

    View full-size slide

  36. ghq
    • ۀ຿Λ͍ͯ͠Ε͹؅ཧ͢ΔgitϦϙδτϦ͸૿͑ଓ
    ͚Δ
    • 20~30ͷϦϙδτϦΛ͖Ε͍ʹ഑ஔ͢Δͷ͸໘౗
    • Golangͷ͓࡞๏ʹैͬͯ؆୯ɺ͖Ε͍ʹϦϙ
    δτϦ؅ཧ͕Ͱ͖Δ
    • $GOPATH/src/{domain}/{user}/{repo}

    View full-size slide

  37. tig
    • CLIͷgitΫϥΠΞϯτ
    • CLIͰgitૢ࡞͍ͯ͠ΔΞφλɻtigΛ࢖Θͳ͍ͳΜͯਓੜͷ
    ൒෼ଛ͍ͯ͠·͢Α
    • ଎͍ɻͦͯ͠syntax highlight is GOT
    • add, resetʹΑΔstage/unstageૢ࡞͕2ഒ଎
    • log, blameʹΑΔௐ͕ࠪ2ഒ଎
    • ΧελϚΠζ͢Ε͹rebase -i ΋2ഒ଎

    View full-size slide

  38. • 1. ͳΜͰCLIͳΜͯ࢖ͬͯΜͷʁϚκͳͷʁ
    • 2. ࠓ೔͔ΒͰ͖ΔCLIվળTIPS
    • 2-1. ڧྗͳγΣϧΛ࢖͓͏
    • 2-2. ௥ՃίϚϯυ/ϓϥάΠϯͰշదͳ࢓ࣄΛ
    • 2-3. ϙʔλϓϧͳ؀ڥͰ͍ͭͰ΋ύϫϑϧ
    • 3. ·ͱΊ

    View full-size slide

  39. ͜͜·Ͱฉ͍ͯ
    Ͳ͏ࢥ͍·͔ͨ͠ʁ

    View full-size slide

  40. ઃఆ/Πϯείେਿwww
    ϦϞʔταʔόʹSSHͨ͠ͱ͖ͱ͔
    PCม͑ͨͱ͖Ͳ͏͢ΜͩΑwww

    View full-size slide

  41. ͱ͔ࢥ͍ͬͯ·͢Ͷʁ

    View full-size slide

  42. dotfilesۦಈ։ൃ
    • CLIͷઃఆ͸͢΂ͯςΩετϑΝΠϧ
    • ͭɾ·ɾΓɻ͢΂ͯόʔδϣϯ؅ཧͰ͖Δ
    • ୭͕ݴ͔ͬͨdotfiles
    • GitHubʹͨͯ·͢͸dotfilesϦϙδτϦ
    • [.̋̋rc]ͥΜͿೖΕͯ
    • git clone ͢ΓΌ͜ΜʹͪΘ

    View full-size slide

  43. zplug
    • zshͷϓϥάΠϯϚωʔδϟ
    • zshͷϓϥάΠϯ͔ΒzshrcͰ࢖༻͍ͯ͠ΔCLIπʔ
    ϧʹࢸΔ·ͰΠϯετʔϧՄೳ
    • zsh͕ىಈͨ͠ॠؒʹઃఆϑΝΠϧ಺ͷϓϥάΠϯΛ
    ͢΂ͯΠϯετʔϧ
    • ͿͬͪΌ্͚ڃऀ޲͖͔ͩΒɺ·ͣ͸prezto͋ͨΓ
    ͔Β࢝Ίͨ΄͏͕Α͛͞

    View full-size slide

  44. make
    • dotfilesͷߏ੒؅ཧ͸makeͰ΍Δ
    • make͸͍͍ͩͨͷOSʹඪ४૷උ
    • chef΍Βansible΍Βେڼͳπʔϧ͸
    dotfilesʹ͸ෆཁ

    View full-size slide

  45. ਺෼͋Ε͹
    Ͳ͜Ͱ͋Ζ͏ͱ΋
    ϘΫͷ͔Μ͕͍͖͑ͨ͞ΐ͏ͷCLI
    ͕࢖͑Δ

    View full-size slide

  46. • 1. ͳΜͰCLIͳΜͯ࢖ͬͯΜͷʁϚκͳͷʁ
    • 2. ࠓ೔͔ΒͰ͖ΔCLIվળTIPS
    • 2-1. ڧྗͳγΣϧΛ࢖͓͏
    • 2-2. ௥ՃίϚϯυ/ϓϥάΠϯͰշదͳ࢓ࣄΛ
    • 2-3. ϙʔλϓϧͳ؀ڥͰ͍ͭͰ΋ύϫϑϧ
    • 3. ·ͱΊ

    View full-size slide

  47. ·ͱΊ
    • CLI͸ࢥߟͱ௚݁ͯ͠ίϚϯυ࣮ߦ͕Ͱ͖Δ͔Βɺ΋
    ͱ΋ͱͷ࣮ߦ଎౓ͱ͍͋·ͬͯ৭ʑ଎͍
    • ΧελϚΠζͰ޾ͤʹͳΕΔɻ೔ʑͷগ͠ͷվળΛ
    ঃʑʹ΍͍ͬͯ͜͏൒೥΋࿔͘Γଓ͚Ε͹ख์ͤͳ
    ͘ͳΔ
    • CLIઃఆ͸ϙʔλϒϧʹ࣋ͪ͸͜ͼՄೳ
    • ई͕ͨΒͳ͗ͯ͢Vim·ͰͨͲΓண͚ͳ͔ͬͨ

    View full-size slide

  48. Let’s enjoy CLI!!

    View full-size slide