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
ターミナルアプリケーションとしてのVim
Search
Toshikazu Ohashi
March 11, 2019
Programming
0
460
ターミナルアプリケーションとしてのVim
ゴリラ.vim #2
https://gorillavim.connpass.com/event/121394/
Toshikazu Ohashi
March 11, 2019
Tweet
Share
More Decks by Toshikazu Ohashi
See All by Toshikazu Ohashi
黒画面が最高のしごと道具である3つの理由
lighttiger2505
0
160
Golangで作るSQL Language Server(sqls)
lighttiger2505
1
640
Connect with many developers from the small plugin
lighttiger2505
0
260
作ってわかる現代のVimのAutoComplete ~そしてVimConf2019へ~
lighttiger2505
3
1.4k
自社サービスのDjangoを 1.3から1.11(LTS)に アップグレードするまでの道のり
lighttiger2505
6
3.2k
LSPがもたらしたVimプラグインの変化に思いを馳せる
lighttiger2505
2
1.2k
Go Language Server 使うべし
lighttiger2505
5
1.9k
Goで作るインタラクティブなCLIコマンドとそのデザイン
lighttiger2505
0
660
GUI is not fast enough!! (GUIには速さが足りないっ!!)
lighttiger2505
0
470
Other Decks in Programming
See All in Programming
AWSでゲームサーバーを運用! Amazon GameLiftのお話
iriikeita
0
200
SDCon2024: Enabling DevOps and Team Topologies thru architecture: architecting for fast flow
cer
PRO
0
790
Prompt FlowによるLLMアプリケーション開発
yuto2000
1
1k
Composing an API the *right* way (Droidcon Berlin 2024)
zsmb
1
450
How NOT to make your DSL terrible
okuramasafumi
0
110
Exploring the Gradually Lost Technical Skills in the Cloud Native Era
hwchiu
2
3.9k
君たちはどうコードをレビューする (される) か / 大吉祥寺.pm
utgwkk
15
8.5k
ぼっちを避けて楽しむためのアノテコノテ / Various Tips and Tricks to Avoid Loneliness and Have Fun
nrslib
3
1.7k
HMSコンペ 11th Solution (team : kansai-kaggler)
t88
1
690
Android開発者のための Kotlin Multiplatform入門
ntaro
0
190
大規模マルチテナントを解決するYugabyteDBという選択肢
nnaka2992
1
250
わかりやすい正解を捨てて、コトに向き合う - スクラムフェス金沢2024 スポンサーセッション
yusukekokubo
0
180
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1026
450k
Writing Fast Ruby
sferik
623
60k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
26
1.6k
What's new in Ruby 2.0
geeforr
338
31k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
360
22k
The Power of CSS Pseudo Elements
geoffreycrofte
64
5.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
121
18k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
13
430
Testing 201, or: Great Expectations
jmmastey
33
6.9k
Bootstrapping a Software Product
garrettdimon
PRO
304
110k
StorybookのUI Testing Handbookを読んだ
zakiyama
15
4.9k
Docker and Python
trallard
37
2.9k
Transcript
λʔϛφϧ ΞϓϦέʔγϣϯ ͱͯ͠ͷ 7JN ΰϦϥWJN !MJHIUUJHFS
ΠϯτϩμΫγϣϯ
7JNͷྑ͞ͱ͍͑ʁ • λʔϛφϧͷதͰىಈ͢Δ • ϞʔυʹΑΔҠಈ/ฤू͕ͱͬͯศར • VimscriptʹΑΔ֦ுੑͷߴ͞ • ىಈͷ͞ •
େମͷαʔόϚγϯͰΠϯετʔϧࡁΈ
ຊͷςʔϚ • λʔϛφϧͷதͰىಈ͢Δ • ϞʔυʹΑΔҠಈ/ฤू͕ͱͬͯศར • VimscriptʹΑΔ֦ுੑͷߴ͞ • ىಈͷ͞ •
େମͷαʔόϚγϯͰΠϯετʔϧࡁΈ
λʔϛφϧͰىಈ͢Δྑ͞ ͱ͍͑ʁ • αʔόϚγϯͩͱͦͦGUIΤσΟλ͕͑ͳ͍ • ଞͷίϚϯυ͔Βͷ࿈ܞ͕εϜʔζʹߦ͑Δ
ຊ͢༰ • αʔόϚγϯͩͱͦͦGUIΤσΟλ͕͑ͳ͍ • ଞͷίϚϯυ͔Βͷ࿈ܞ͕εϜʔζʹߦ͑Δ
ίϚϯυ͔Β7JNΛίʔϧ ͢Δͱ͍͏͜ͱ
7JNΛίʔϧ͢ΔίϚϯυͱ • crontab -e • git commit • etc... ࣮ߦ͢ΔͱΤσΟλ(Vimͱ͔)Λىಈͯ͠ϑΝΠϧΛ։͘->
อଘͯ͠ดͨ͡ͱ͖ɺฤू݁ՌΛύʔεͯ͠͏ίϚϯυ
%FNP • git commit • SQL client(mysql, psql, etc)
౾ࣝ git commit ͱ͔ git rebase -i Ωϟϯηϧ͍ͨ͠Μ Ͱ͚͢Ͳ •
:cq ͠·͠ΐ͏ • ฤू༰Λഁغͯ͠ΤϥʔίʔυΛฦ͠·͢
ڥม&%*503
7JNͰ͔͠։͔ͳ͍ʁ • ΤσΟλΛ։͘ίϚϯυଟ͘ͷ߹EDITORʹઃఆ͞ Ε͍ͯΔίϚϯυΛ࣮ߦ͢Δ • export EDITOR=vim ͩͱVimΛىಈ͢Δ • ׳शͱͯ͠ͷ͜͏ͳ͍ͬͯΔ͚ͩͳͷͰɺEDITORΛ
༻͠ͳ͍ίϚϯυ͋Δ
74$PEFΛىಈ͍ͨ͠ • ୯७ʹ export EDITOR=code ͩͱବ • ىಈޙϓϩηε͕ৗற͢ΔλΠϓͷΤσΟλͩͱฤू ྃΛͨͳ͍ •
ϑΝΠϧ։͍ͯଈ࠲ʹίϚϯυͱͯ͠ऴΘΔ • export EDITOR='code --wait' • --waitΛ͚ͭΔ͜ͱͰฤूྃ·ͰͭΑ͏ʹͳΔ
%FNP • git commit on vscode
74$PEFͰ͍͍ͷͰʁ • (ྲྀੴʹVimʹൺΔͱ)ىಈ͕͍ • λʔϛφϧʹΔ·Ͱʹϫϯεςοϓඞཁ • VimͳΒ :wq ͰΔ •
VSCodeͳΒ อଘͯ͠ด͡Δ > λʔϛφϧʹΔ
͜͜·Ͱͷ·ͱΊ • λʔϛφϧ্ͰίϚϯυ͔ΒVimΛݺͼग़͢ͷศར • ىಈ૬·ͬͯɺίϚϯυ͔Βίʔϧ͞ΕΔΤσΟ λͱͯ͠VimʹΞυόϯςʔδ͕͋Δͱࢥ͍ͬͯΔ
͖ΈWJNEJ⒎Λ ͍ͬͯ͠Δ͔
WJNEJ⒎ͱ Vimʹଂ͞Ε͍ͯΔࠩදࣔ/Ϛʔδπʔϧ • vimdiff file1 file2 [file3 [file4]] • vim
-d file1 file2 [file3 [file4]]
%FNP • vimdiff
(JU࿈ܞ
(JU WJNEJ⒎ • git difftool ͰࠩใΛ֎෦πʔϧʹ࿈ܞ͢Δ͜ͱ ͕Ͱ͖Δ • GitͷࠩΛVim্ͰݟΔ͜ͱ͕Ͱ͖Δ •
git mergetool ͰίϯϑϦΫτใΛ֎෦πʔϧʹ࿈ ܞ͢Δ͜ͱ͕Ͱ͖Δ • GitͷίϯϑϦΫτΛVimͰղফ͢Δ͜ͱ͕Ͱ͖Δ
(JUͷEJ⒎UPPMʹ7JNΛ͏ • ҎԼͷઃఆΛ~/.gitconfigʹՃ͢Δ͜ͱͰvimdiff ΛGitͷdifftoolͳ͍͠mergetoolͱͯ͠ొͰ͖Δ [diff] tool = vimdiff [merge] tool
= vimdiff
Ԡ༻ฤ5JH࿈ܞ
5JHͱ • λʔϛφϧ্ͰGitΛϦονʹදࣔ͢ΔTUIΞϓϦ • ઃఆϑΝΠϧ(~/.tigrc)ͰڍಈΛΧελϚΠζͰ͖Δ • ҎԼͷઃఆΛೖΕΔ͜ͱͰɺtigͰબͨ͠diffΛ vimdiffͰݟΔ͜ͱ͕Ͱ͖Δ bind main
D !sh -c "git difftool %(commit)~ %(commit)" bind diff D !sh -c "git difftool %(commit)~ %(commit)" bind refs D !sh -c "git difftool %(branch)"
%FNP • tig & git difftool
/FP7JNͷWJNEJ⒎
/FP7JNͷWJNEJ⒎ •vimdiffͱ͍͏ίϚϯυVimͷγϯϘϦοΫϦϯΫ •NeoVimΠϯετʔϧࡁΈͰvimdiffΛୟ͘ͱVim͕ىಈ •NeoVimͷࠩϞʔυΛvimdiffͰ࣮ߦ͢Δ߹ɺҎԼͷ ΤΠϦΞεઃఆ͕ඞཁ alias vimdiff='nvim -d'
/FP7JNͷHJU<EJ⒎NFSHF>UPPM • git [diff/merge]toolΤΠϦΞεΛݟͳ͍ • NeoVimͷvimdiffΛ͏߹ɺ~/.gitconfigʹҎԼ ͷઃఆ͕ඞཁ [difftool "vimdiff"] cmd
= "nvim -R -d -c \"wincmd l\" -d \"$LOCAL\" \"$REMOTE\"" [mergetool "vimdiff"] cmd = "nvim -d -c \"4wincmd w | wincmd J\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" \"$MERGED\""
࠷ޙʹ
ࠓ͔͑ͨͬͨϝοηʔδ • Vim͕ϑΟοτ͢Δൣғ෯͍ • ϝϞॻ͖ͷΑ͏ͳͪΐͬͱͨ͠ฤू • IDEͷΑ͏ͳॏ͍ฤू • VimΛىಈͯ͠Ӡʑ͚ͩͰͳ͘ɺ֎෦͔ΒVimΛىಈ͢Δ ͱͤͳ͜ͱ͕͋Δύλʔϯ͋Δ
7JNͦΕՄೳੑͷ्
ࣗݾհ lighttiger2505 •αʔόαΠυΤϯδχΞ@iRidge •ࣄ:Python •झຯ:Golang࣌ʑVimscript •lab •deoplete-vim-lsp