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
780
知ってるとお得な 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
790
GitHub の README をいい感じにする / Cool Readme
blue0513
3
1.6k
Emacs × Sound やってみた / Emacs with Sound
blue0513
1
950
Slack を TweetDeck にしてみた件 / slackdeck-proto
blue0513
0
2.8k
クラウド電子カルテを支える魂の技術
blue0513
0
2.3k
Other Decks in Programming
See All in Programming
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
260
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
testcontainers のススメ
sgash708
1
120
Go の GC の不得意な部分を克服したい
taiyow
2
760
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
200
バグを見つけた?それAppleに直してもらおう!
uetyo
0
170
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
450
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
650
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
.NET 9アプリをCGIとして レンタルサーバーで動かす
mayuki
1
770
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
95
5.2k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Building an army of robots
kneath
302
44k
Designing for Performance
lara
604
68k
The Cult of Friendly URLs
andyhume
78
6.1k
Into the Great Unknown - MozCon
thekraken
33
1.5k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
For a Future-Friendly Web
brad_frost
175
9.4k
Making the Leap to Tech Lead
cromwellryan
133
9k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.2k
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 ‣ ͓͢͢ΊػೳΛͥͻڭ͑ͯ͘Εʂ