eth-p / bat-extras

Bash scripts that integrate bat with various command line tools.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

batdiff: git diffing not displaying code changes

ajlive opened this issue · comments

Expected behavior: batdiff would show me what previous code for lines that were either changed or removed, similar to git diff:

$ git diff .config/fish/config.fish
diff --git a/.config/fish/config.fish b/.config/fish/config.fish
index 960a7f2..0671359 100644
--- a/.config/fish/config.fish
+++ b/.config/fish/config.fish
@@ -48,12 +48,14 @@ set -x PATH /opt/homebrew/sbin $PATH
 # User
 set -x PATH $HOME/bin $PATH

+# New thing
+
 # Visual Studio Code
 alias code /usr/local/bin/code-insiders

 # Docker
-alias dk 'docker'
-alias dkc 'docker compose'
+alias dock 'docker'
+alias duck 'docker compose'

 # Pyenv
 set -x PYENV_ROOT $HOME/.pyenv
@@ -61,10 +63,6 @@ set fish_user_paths $PYENV_ROOT/bin $fish_user_paths
 status is-interactive; and pyenv init --path | source
 pyenv init - | source

-# Plan 9
-set -x PLAN9 /usr/local/plan9
-set -x PATH $PATH $PLAN9/bin
-
 # thefuck
 thefuck --alias | source

Got: batdiff does show lines added, but

  • it only shows that lines changed, not what the changes were
  • it only shows a single "-" to indicate that some number of lines were removed, and does not show how many or what they were
$ batdiff .config/fish/config.fish
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: .config/fish/config.fish
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
  49   │ set -x PATH $HOME/bin $PATH
  50   │
  51 + │ # New thing
  52 + │
  53   │ # Visual Studio Code
  54   │ alias code /usr/local/bin/code-insiders
  55   │
  56   │ # Docker
  57 ~ │ alias dock 'docker'
  58 ~ │ alias duck 'docker compose'
  59   │
  60   │ # Pyenv
 ...   │ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ 8< ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─
  63   │ status is-interactive; and pyenv init --path | source
  64   │ pyenv init - | source
  65 _ │
  66   │ # thefuck
  67   │ thefuck --alias | source
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Am I doing it wrong?

commented

@ajlive Hi. I have the same issue but I think we are doing guchi. As I understand this is a default "bat" behaviour (you can check it the styling for git integration for - https://github.com/sharkdp/bat#git-integration).

So it for a better diff styling you need to use delta and you can combine it with batdiff => batdiff --delta but it will cause a bug that was fixed and hasn't been released yet (#72 (reference))?

So I recommend you either switch to git diff + delta or ping the main contributor, or ask the same question about showing removing lines in the bat repo issues section (but I assume that they are using sublime text git logic).

switch to git diff + delta

Thanks for the suggestion! Works great. I'll close this.