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
790
知ってるとお得な 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
Zoneless Testing
rainerhahnekamp
0
120
Beyond ORM
77web
7
950
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
100
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
110
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
140
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
190
数十万行のプロジェクトを Scala 2から3に完全移行した
xuwei_k
0
280
暇に任せてProxmoxコンソール 作ってみました
karugamo
2
720
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
useSyncExternalStoreを使いまくる
ssssota
6
1.2k
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
Featured
See All Featured
Designing for humans not robots
tammielis
250
25k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Music & Morning Musume
bryan
46
6.2k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
A Philosophy of Restraint
colly
203
16k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Documentation Writing (for coders)
carmenintech
66
4.5k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Rails Girls Zürich Keynote
gr2m
94
13k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
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 ‣ ͓͢͢ΊػೳΛͥͻڭ͑ͯ͘Εʂ