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
210
ElectronでSlackをさらに便利にしちゃう / Slack with Electron
blue0513
3
770
GitHub の README をいい感じにする / Cool Readme
blue0513
3
1.6k
Emacs × Sound やってみた / Emacs with Sound
blue0513
1
940
Slack を TweetDeck にしてみた件 / slackdeck-proto
blue0513
0
2.8k
クラウド電子カルテを支える魂の技術
blue0513
0
2.3k
Other Decks in Programming
See All in Programming
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
Realtime API 入門
riofujimon
0
150
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
890
Arm移行タイムアタック
qnighy
0
310
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
330
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
31
6.3k
Agile that works and the tools we love
rasmusluckow
327
21k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Optimizing for Happiness
mojombo
376
70k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Producing Creativity
orderedlist
PRO
341
39k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Into the Great Unknown - MozCon
thekraken
32
1.5k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
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 ‣ ͓͢͢ΊػೳΛͥͻڭ͑ͯ͘Εʂ