Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ターミナルアプリケーションとしてのVim

 ターミナルアプリケーションとしてのVim

Toshikazu Ohashi

March 11, 2019
Tweet

More Decks by Toshikazu Ohashi

Other Decks in Programming

Transcript

  1. ౾஌ࣝ git commit ͱ͔ git rebase -i Ωϟϯηϧ͍ͨ͠Μ Ͱ͚͢Ͳ •

    :cq ͠·͠ΐ͏ • ฤू಺༰Λഁغͯ͠ΤϥʔίʔυΛฦ͠·͢
  2. 74$PEFΛىಈ͍ͨ͠ • ୯७ʹ export EDITOR=code ͩͱବ໨ • ىಈޙϓϩηε͕ৗற͢ΔλΠϓͷΤσΟλͩͱฤू ׬ྃΛ଴ͨͳ͍ •

    ϑΝΠϧ։͍ͯଈ࠲ʹίϚϯυͱͯ͠͸ऴΘΔ • export EDITOR='code --wait' • --waitΛ͚ͭΔ͜ͱͰฤू׬ྃ·Ͱ଴ͭΑ͏ʹͳΔ
  3. (JU WJNEJ⒎ • git difftool Ͱࠩ෼৘ใΛ֎෦πʔϧʹ࿈ܞ͢Δ͜ͱ ͕Ͱ͖Δ • Gitͷࠩ෼ΛVim্ͰݟΔ͜ͱ͕Ͱ͖Δ •

    git mergetool ͰίϯϑϦΫτ৘ใΛ֎෦πʔϧʹ࿈ ܞ͢Δ͜ͱ͕Ͱ͖Δ • GitͷίϯϑϦΫτΛVimͰղফ͢Δ͜ͱ͕Ͱ͖Δ
  4. 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)"
  5. /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\""