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
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
Click-free releases & the making of a CLI app
oheyadam
2
120
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
flutterkaigi_2024.pdf
kyoheig3
0
150
カンファレンスの「アレ」Webでなんとかしませんか? / Conference “thing” Why don't you do something about it on the Web?
dero1to
1
110
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
Better Code Design in PHP
afilina
PRO
0
130
Jakarta EE meets AI
ivargrimstad
0
690
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
Functional Event Sourcing using Sekiban
tomohisa
0
100
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Speed Design
sergeychernyshev
25
620
A Modern Web Designer's Workflow
chriscoyier
693
190k
Designing for humans not robots
tammielis
250
25k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Become a Pro
speakerdeck
PRO
25
5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Fireside Chat
paigeccino
34
3k
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 ‣ ͓͢͢ΊػೳΛͥͻڭ͑ͯ͘Εʂ