ターミナルがダサいとモテない。git-deltaでgit diff/lazygitをside-by-sideでおしゃれ表示
Yusuke Hasegawa

Yusuke Hasegawa @yusukeh

About: I’m Yusuke, CEO of grasys Inc., a Japanese MSP specializing in scalable, high-performance cloud infrastructure and operations.

Location:
Tokyo, Japan
Joined:
May 29, 2025

ターミナルがダサいとモテない。git-deltaでgit diff/lazygitをside-by-sideでおしゃれ表示

Publish Date: Jun 24
0 0

git-delta使ってますか?


Photo by Yancy Min on Unsplash

うちの社内でneovimユーザーを増やそうとしているんですが、git clientがやっぱり障壁になるんだなと・・・

そこでlazygitを伝えたんですが、ついでなのでMediumに😆

VS Codeで触った方がいいだろうし、GUIの方がいいのもそうだと思います。

Command-Lineだと確かにめんどくさい。

Linuxのインフラ系エンジニアしかgit command触らないんじゃないかと勝手に思ったりしてます🐧

Install delta

GitHub - dandavison/delta: A syntax-highlighting pager for git, diff, grep, and blame output

deltaはけっこう有名なツールなので検索するといっぱい出てくると思います。

CLIでもside-by-sideで表示してくれ、見やすくて自分はこれがないと辛いくらいです。

side-by-sideってなんだってなると思いますが上のgithubのLinkから見れるので、見ていただければすぐわかって頂けると思います。

macOSであればbrewでも入ります。

brew install git-delta
Enter fullscreen mode Exit fullscreen mode

自分はcargoでInstallしてます。

Rustのセットアップが必要ですが、cargoでのInstallはこちら

cargo install git-delta
Enter fullscreen mode Exit fullscreen mode

Install lazygit

lazygitはTerminal用のgit clientです。

GitHub - jesseduffield/lazygit: simple terminal UI for git commands

NeoVimAstroNvimはlazygitに対応していてtoggle terminalでlazygitを呼び出すことができます。

実際のInstallはこちらにあります。

GitHub - jesseduffield/lazygit: simple terminal UI for git commands

macOSならbrewでも良いですし、go installでも入ります。

brew install jesseduffield/lazygit/lazygit
brew install lazygit
Enter fullscreen mode Exit fullscreen mode

自分はgo installで入れてます。

go install github.com/jesseduffield/lazygit@latest
Enter fullscreen mode Exit fullscreen mode

実際のAstroNvimからの呼び出しはここに

⌨️ Mappings

他にも設定次第ではありますが、 Leader + gg でも呼べると思います。

lazygit config.yml path

またlazygitのconfig default pathがmacOSだと痒い場所なので変えます😁

configのdefault pathはここを見るとわかります。

lazygit/docs/Config.md at master · jesseduffield/lazygit

~/Library/Application\ Support/lazygit/config.yml

自分はbashなので以下でLG_CONFIG_FILEを設定してます。

ついでにlazygitって長いのでlgってaliasを貼るんですが、lazygitのargsを活かしたいのでfunctionで呼びます😂

if command -v lazygit &> /dev/null; then
  declare -x LG_CONFIG_FILE=~/.config/lazygit/config.yml
  export LG_CONFIG_FILE

  function lg(){
    lazygit "$@"
  }
fi
Enter fullscreen mode Exit fullscreen mode

これで今いるdirectoryがgitのrepositoryならlazygitが起動します。

lazygit config.yml

自分の設定は以下です。

しっかりgit-deltaもdraculaです🧛

siginingは必要ない人は削ってください🔐

git:
  autocommit: false
  signing:
    key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    signOff: true
  paging:
    colorArg: always
    pager: delta --paging=never --true-color=auto --dark --side-by-side --line-numbers --syntax-theme=Dracula --width=variable --navigate
    #useConfig: true
#
gui:
  # DRACULA
  theme:
    activeBorderColor:
      - "#FF79C6"
      - bold
    inactiveBorderColor:
      - "#BD93F9"

    searchingActiveBorderColor:
      - "#8BE9FD"
      - bold

    optionsTextColor:
      - "#6272A4"

    selectedLineBgColor:
      - "#6272A4"

    inactiveViewSelectedLineBgColor:
      - bold

    cherryPickedCommitFgColor:
      - "#6272A4"

    cherryPickedCommitBgColor:
      - "#8BE9FD"

    markedBaseCommitFgColor:
      - "#8BE9FD"

    markedBaseCommitBgColor:
      - "#F1FA8C"

    unstagedChangesColor:
      - "#FF5555"

    defaultFgColor:
      - "#F8F8F2"
Enter fullscreen mode Exit fullscreen mode

これでAstroNvimからlazygitを呼び出してlazygitの差分表示をside-by-sideにおしゃれ表示できます。

個人的にはこれがないと差分見たくないくらいです😂

Appendix: git + git-delta

git command自体にもgit-deltaを適用できます。

自分はこんな設定にしています。

[pager]
  diff = delta
  log = delta
  reflog = delta
  show = delta

[delta]
  width = variable
  true-color = always
  dark = true
  light = false
  features = "side-by-side line-numbers"
  syntax-theme = Dracula
  navigate = true
  line-numbers = true
  side-by-side = true
  wrap = true
Enter fullscreen mode Exit fullscreen mode

git [log|reflog]だけ-pを付ける必要がありますがside-by-side表示されます🚙

git log -p
git reflog -p
Enter fullscreen mode Exit fullscreen mode

Comments 0 total

    Add comment