Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
知ってるとお得な iTerm2 と zsh/bash の小技
Search
Taiju Aoki
June 14, 2019
Programming
2
770
知ってるとお得な iTerm2 と zsh/bash の小技
LT for M3 Tech Talk #118
Taiju Aoki
June 14, 2019
Tweet
Share
More Decks by Taiju Aoki
See All by Taiju Aoki
本番運用中 Oracle を破壊してしまった話 ~ 破壊と創世 ~ / Oracle Destruction and Creation
blue0513
0
2.8k
オンプレ to オンプレした話/on-premises2on-premises
blue0513
0
2.8k
GitもCIもテストもないプロジェクトでデプロイを自動化するまでの道 / rebuild of DevOps
blue0513
0
3k
Git & GitLab & コードレビューって? / about Git, GitLab, CodeReview
blue0513
0
200
ElectronでSlackをさらに便利にしちゃう / Slack with Electron
blue0513
3
760
GitHub の README をいい感じにする / Cool Readme
blue0513
3
1.6k
Emacs × Sound やってみた / Emacs with Sound
blue0513
1
930
Slack を TweetDeck にしてみた件 / slackdeck-proto
blue0513
0
2.8k
クラウド電子カルテを支える魂の技術
blue0513
0
2.3k
Other Decks in Programming
See All in Programming
GCCのプラグインを作る / I Made a GCC Plugin
shouth
1
150
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
390
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
470
Kubernetes for Data Engineers: Building Scalable, Reliable Data Pipelines
sucitw
1
190
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
330
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.1k
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
のびしろを広げる巻き込まれ力:偶然を活かすキャリアの作り方/oso2024
takahashiikki
1
400
現場で役立つモデリング 超入門
masuda220
PRO
12
2.9k
Piniaの現状と今後
waka292
5
1.4k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
380
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
51
32k
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
519
39k
The Language of Interfaces
destraynor
154
24k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
The Art of Programming - Codeland 2020
erikaheidi
51
13k
Raft: Consensus for Rubyists
vanstee
136
6.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
13
1.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Adopting Sorbet at Scale
ufuk
73
9k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
3
370
Transcript
ͬͯΔͱ͓ಘͳ iTerm2 ͱ zsh/bash ͷখٕ @blue_1617
ࢲ୭ʁ blue (@blue_1617) 2 ࠷ۙͷͰ͖͝ͱ ‣ Nintendo Switch ങ͍·ͨ͠ ‣
Chromecastɺ40 inch ϞχλΛߪೖݕ౼த ‣ ϓϩόΠμΛ so-net ʹมߋ ‣ νʔϜτοϓ3ͷ࣮ྗऀʢϝϯό: 3ʣ ‣ গͳ͍ Emacs Ϣʔβ ‣ θϧμɺΉ͔ͣ͘͠ͳ͍͔ʁ
͜ͷൃදԿʁ 3 ΤσΟλ λʔϛφϧ ΤϯδχΞͷث
͜ͷൃදԿʁ 4 ΤσΟλ λʔϛφϧ ΤϯδχΞͷث આڃͷث͕ͩɺ͍͜ͳͤͳ͚Εҙຯ͕ͳ͍
આڃͷث͕ͩɺ͍͜ͳͤͳ͚Εҙຯ͕ͳ͍ ͜ͷൃදԿʁ 5 ΤσΟλ λʔϛφϧ ΤϯδχΞͷث খٕΛຏ͖ͬ͘Όͳ͍
͜ͷൃදԿʁ 6 ΤσΟλͷখٕ λʔϛφϧͷখٕ ‣ iTerm2 ͷখٕ ‣ zsh/bash ͷখٕ
‣ package ͷ͍ํ ‣ package ͷ࡞Γํ
͜ͷൃදԿʁ 7 ΤσΟλͷখٕ λʔϛφϧͷখٕ ‣ iTerm2 ͷখٕ ‣ zsh/bash ͷখٕ
‣ package ͷ͍ํ ‣ package ͷ࡞Γํ
iTerm2 ͷখٕ
1. Hotkey 9 ‣ HotkeyΛొ͢Δ ‣ Ͳͷը໘Ͱॠ࣌ʹλʔϛφϧΛදࣔͤ͞ΒΕΔ ϙοϓΞοϓ͢Δ
1-1. ઃఆͱࢫຯ 10 ‣ ΤσΟλૢ࡞தͰը໘ΛҠಈͤͣλʔϛφϧૢ࡞Ͱ͖Δ ‣ ͳΜ͔ݟ͕ͨΧοί͍͍ https://www.iterm2.com/documentation-hotkey.html ઃఆ ࢫຯ
‣ ެࣜDocΛಡΉ ‣ " iTerm2 Hotkey ઃఆ " ͱ͔ͰάάΔ
2. Triggers 11 ‣ Ԡ͢ΔจࣈྻΛొ͢Δ ‣ จࣈྻ͕ඳը͞ΕΔͱɺ௨ΛඈͤΔ ௨͕ඈΜͰ͘Δ
2-1. ઃఆͱࢫຯ 12 ‣ ϏϧυऴྃϒϨʔΫϙΠϯτൃՐͷλΠϛϯάΛΕΔ ‣ Ͳͷը໘ʹ͍ͯ௨Λड͚औΕΔ https://www.iterm2.com/documentation-triggers.html ઃఆ ࢫຯ
‣ ެࣜDocΛಡΉ ‣ " iTerm2 Trigger ઃఆ " ͱ͔ͰάάΔ
3. Maximize Active Pane 13 ‣ λʔϛφϧͷPaneΛϫϯίϚϯυͰ࠷େԽͰ͖Δ ΊͬͪΌ֦େ͢Δ
3-1. ઃఆͱࢫຯ 14 ‣ େ͖ͳը໘ͰϩάͳͲΛݟΒΕΔ ‣ ϖΞϓϩͷ࣌ʹಉ྅ʹը໘Λݟͤ͘͢ͳΔ ઃఆ ࢫຯ ‣
Cmd + Shift + Enter Ͱ͍͚Δ
4. change color by ssh 15 ‣ ϗετ໊Λࢦఆ͓ͯ͘͠ ‣ sshͨ͠ઌͷϗετ໊ʹΑΓɺഎܠ৭͕มΘΔ
4-1. ઃఆͱࢫຯ 16 ‣ ssh ͨ͠/͍ͯ͠Δઌ͕ҰൃͰΘ͔Δ ‣ ຊ൪ڥʹ ssh ͨ͠ͱ͖ʹࣄނΒͳ͍
ઃఆʢͲͪΒ͔ʣ ࢫຯ ‣ iTerm2 ͷ "Automatic Profile Switching" Λ͏ ‣ ssh ίϚϯυΛϑοΫͯ͠ iTerm2 ͷ Profile ΛΓସ͑Δ https://www.iterm2.com/documentation-escape-codes.html https://www.iterm2.com/documentation-automatic-profile-switching.html
zsh/bash ͷখٕ
5. peco 18 ‣ ΠϯΫϦϝϯλϧͳߜΓࠐΈΛ࣮ݱ͢Δ `root nt` ͱ͍͏จࣈྻΛߜΓࠐΊΔ
5-1. ઃఆͱࢫຯ 19 ‣ ΠϯΫϦϝϯλϧαʔν͕͑ΔΑ͏ʹͳΔ ‣ ༷ʑͳίϚϯυͱΈ߹ΘͤΒΕΔʢޙड़ʣ ઃఆ ࢫຯ ‣
ެࣜREADMEΛಡΉ ‣ " peco Πϯετʔϧ ํ๏" ͱ͔ͰάάΔ https://github.com/peco/peco
5-2. peco Ͱ history Λݕࡧ͢Δ 20 ‣ history͔ΒΠϯΫϦϝϯλϧʹίϚϯυΛݕࡧͰ͖Δ ‣ "
peco history search " ͱ͔ͰάάΔͱઃఆͰ͖Δ
5-3. peco Ͱ git checkout ઌΛબ͢Δ 21 ‣ branchͷத͔ΒΠϯΫϦϝϯλϧʹcheckoutઌΛ୳ͤΔ ‣
" peco git checkout " ͱ͔ͰάάΔͱઃఆͰ͖Δ
6. enhancd 22 ‣ աڈʹ cd ͨ͠σΟϨΫτϦʹඈΔ ‣ peco ΛͬͯΠϯΫϦϝϯλϧʹબͰ͖Δ
6-1. ઃఆͱࢫຯ 23 ‣ ΠϯΫϦϝϯλϧαʔν͕ cd Ͱ͑ΔΑ͏ʹͳΔ ‣ ҰॠͰผσΟϨΫτϦʹඈΔ ઃఆ
ࢫຯ ‣ ެࣜREADMEΛಡΉ ‣ " enhancd Πϯετʔϧ ํ๏" ͱ͔ͰάάΔ https://github.com/peco/peco
7. zsh-autosuggestions 24 ‣ ཤྺ͔ΒίϚϯυͷࣗಈิΛͯ͘͠ΕΔ աڈͷೖྗ͕ิ͞ΕΔ
7-1. ઃఆͱࢫຯ 25 ‣ աڈͷίϚϯυཤྺΛݩʹࣗಈิ͕ޮ͘Α͏ʹͳΔ ‣ λΠϓྔ͕͔ͳΓݮΔ ઃఆ ࢫຯ ‣
ެࣜREADMEΛಡΉ ‣ " zsh-auto-suggestions Πϯετʔϧ " ͱ͔ͰάάΔ https://github.com/zsh-users/zsh-autosuggestions
8. zsh-history-substring-search 26 ‣ historyத͔ΒɺೖྗதͷίϚϯυʹྨࣅͨ͠ͷΛ୳ͤΔ Ctrl + p Ctrl +
p
8-1. ઃఆͱࢫຯ 27 ‣ աڈͷίϚϯυཤྺ͔Βಉ͡Α͏ͳίϚϯυΛ୳ͤΔ ‣ peco ʹΑΔݕࡧΑΓϫϯΞΫγϣϯগͳ͘ಈ࡞͢Δ ઃఆ ࢫຯ
‣ ެࣜREADMEΛಡΉ ‣ "zsh-history-substring-search Πϯετʔϧ" ͰάάΔ https://github.com/zsh-users/zsh-history-substring-search
9. zsh-git-prompt 28 ‣ ݱࡏͷbranchͱstatusΛϓϩϯϓτʹදࣔͰ͖Δ
9-1. ઃఆͱࢫຯ 29 ‣ ॠ࣌ʹ branch ໊ͱ git status ͕Θ͔Δ
ઃఆ ࢫຯ ‣ ެࣜREADMEΛಡΉ ‣ "zsh git status prompt" ͱ͔ͰάάΔ https://github.com/olivierverdier/zsh-git-prompt
͓·͚: Enter ͚ͩͰ git status ͯ͠Δ 30 ‣ Enter Λଧͭͱɺݱࡏͷ
git status ΛදࣔͰ͖Δ
͓·͚: ઃఆͱࢫຯ 31 ‣ ศརؔΛࣗͰఆٛͰ͖Δ͜ͱΛ࣮ײͰ͖Δ ઃఆ ࢫຯ ‣ zshrc ʹࣗͰؔΛఆٛ͢Δ
‣ " zsh enter git status " ͱ͔ͰάάΕͳΜͱ͔ͳΔ
·ͱΊ
࠷ޙʹ ‣ ΤσΟλλʔϛφϧڧ͘Ͱ͖Δ ‣ ΤσΟλλʔϛφϧϓϩάϥϚͷث ‣ ثΛຏ͘ͷવͱͯ͠ɺ͍͜ͳ͢খٕେࣄ 33 ‣ ͬͱศརʹʂͬͱڧ͘ʂ
‣ ෆศͩͳͱࢥͬͨ୭͔͕ղফ͍ͯ͠Δέʔε͕ଟ͍ ‣ ͦΕͰͳ͚Εࣗ࡞͢ΕOK ‣ ެ։͞Ε͍ͯΔ repository ʹ issue ΛཱͯΔͷOK ‣ ͓͢͢ΊػೳΛͥͻڭ͑ͯ͘Εʂ