git-split-diffs

    0.10.0 • Public • Published

    git-split-diffs

    GitHub style split diffs with syntax highlighting in your terminal.

    Screenshot of dark theme

    Screenshot of github-light theme

    Demo 1 | Demo 2

    Usage

    This currently requires node version 12 or newer to run.

    Install globally

    npm install -g git-split-diffs
    
    git config --global core.pager git-split-diffs --color | less -RFX

    Install locally

    npm install git-split-diffs
    
    git config core.pager npx git-split-diffs --color | less -RFX

    Use manually

    git diff | git-split-diffs --color | less

    Customization

    Line wrapping

    By default, lines are wrapped to fit in the screen. If you prefer to truncate them update the wrap-lines setting:

    git config split-diffs.wrap-lines false
    

    Inline changes

    By default, salient changes within lines are also highlighted: Screenshot of inline changes

    This adds a small overhead to rendering. You can disable this with the highlight-line-changes setting:

    git config split-diffs.highlight-line-changes false
    

    Syntax highlighting

    Syntax highlighting is supported using the same grammars and themes as vscode, via shiki. Each theme specifies a default syntax highlighting theme to use, but that can be overridden by:

    git config split-diffs.syntax-highlighting-theme <name>
    

    Supported syntax highlighting theme names are mentioned here: https://github.com/shikijs/shiki/blob/master/docs/themes.md#all-themes

    Note that syntax highlighting is the slowest operation, so you can disable it for faster diffs:

    git config split-diffs.syntax-highlighting-theme ''
    

    Narrow terminals

    Split diffs can be hard to read on narrow widths, so if we cannot fit two lines of min-line-width on screen, we revert to unified diffs. This value is configurable:

    git config split-diffs.min-line-width 40
    

    This defaults to 80, so screens below 160 characters will display unified diffs. Set it to 0 to always show split diffs.

    Themes

    You can pick between several themes:

    Arctic

    Based on https://www.nordtheme.com/

    git config split-diffs.theme arctic
    

    Screenshot of GitHub Dark (Dim) theme

    Dark

    This is the default theme.

    git config split-diffs.theme dark
    

    Screenshot of dark theme

    Light

    git config split-diffs.theme light
    

    Screenshot of light theme

    GitHub Dark (Dim)

    git config split-diffs.theme github-dark-dim
    

    Screenshot of GitHub Dark (Dim) theme

    GitHub Light

    git config split-diffs.theme github-light
    

    Screenshot of GitHub Light theme

    Solarized Dark

    As seen on https://github.com/altercation/solarized

    git config split-diffs.theme solarized-dark
    

    Screenshot of Solarized Dark theme

    Solarized Light

    git config split-diffs.theme solarized-light
    

    Screenshot of Solarized Light theme

    Monochrome Dark

    git config split-diffs.theme monochrome-dark
    

    Screenshot of Monochrome Dark theme

    Monochrome Light

    git config split-diffs.theme monochrome-light
    

    Screenshot of Monochrome Light theme

    Install

    npm i git-split-diffs

    DownloadsWeekly Downloads

    47

    Version

    0.10.0

    License

    MIT

    Unpacked Size

    35 kB

    Total Files

    18

    Last publish

    Collaborators

    • banga