All Projects → banga → git-split-diffs

banga / git-split-diffs

Licence: MIT license
GitHub style split diffs in your terminal

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to git-split-diffs

Gatsby Remark Vscode
Gatsby plugin to provide VS Code’s syntax highlighting to Markdown code fences
Stars: ✭ 245 (-89.89%)
Mutual labels:  syntax-highlighting
auditor
auditor, the missing audit log library
Stars: ✭ 105 (-95.67%)
Mutual labels:  diffs
vim-stylus
A better vim plugin for stylus, including proper and up-to-date syntax highligting, indentation and autocomplete
Stars: ✭ 49 (-97.98%)
Mutual labels:  syntax-highlighting
lua-syntaxhighlight
A code syntax to HTML highlighter using lexers from Textadept
Stars: ✭ 20 (-99.17%)
Mutual labels:  syntax-highlighting
GitHub-Modern-Theme-for-Emacs
Syntax highlighting color theme mimicking the new and updated look of GitHub's code viewer.
Stars: ✭ 37 (-98.47%)
Mutual labels:  syntax-highlighting
vscode-arm
Arm® Syntax highlighting for VSCode
Stars: ✭ 35 (-98.56%)
Mutual labels:  syntax-highlighting
Notehighlight2016
Source code syntax highlighting for OneNote 2016 and OneNote for O365 . NoteHighlight 2013 port for OneNote 2016 (32-bit and 64-bit)
Stars: ✭ 2,907 (+19.98%)
Mutual labels:  syntax-highlighting
sublime rainbow csv
🌈Rainbow CSV - Sublime Text Package: Highlight columns in CSV and TSV files and run queeries in SQL-like language
Stars: ✭ 97 (-96%)
Mutual labels:  syntax-highlighting
4coder skytrias
4coder customization layer for Odin Lang
Stars: ✭ 37 (-98.47%)
Mutual labels:  syntax-highlighting
SyntaxPane
A simple to use Swing JEditorKit component supporting syntax highlighting for various languages. Issue tracker: https://codeberg.org/sciss/SyntaxPane/issues
Stars: ✭ 32 (-98.68%)
Mutual labels:  syntax-highlighting
SynWrite
SynWrite text editor. Not the entire source, because EControl is closed-source. If you get the license for EControl, I will help to compile the SynWrite.
Stars: ✭ 68 (-97.19%)
Mutual labels:  syntax-highlighting
bioSyntax-archive
Syntax highlighting for computational biology
Stars: ✭ 16 (-99.34%)
Mutual labels:  syntax-highlighting
knowledge-graph-change-language
Tools for working with KGCL
Stars: ✭ 14 (-99.42%)
Mutual labels:  diffs
Vim Afterglow
Vim adaptation of the Afterglow colorscheme
Stars: ✭ 248 (-89.76%)
Mutual labels:  syntax-highlighting
linden-scripting-language
Linden Scripting Language (LSL / Second Life) files for your editor.
Stars: ✭ 53 (-97.81%)
Mutual labels:  syntax-highlighting
Npp Vs2012 Dark
Visual Studio 2012 Dark Theme for Notepad++
Stars: ✭ 236 (-90.26%)
Mutual labels:  syntax-highlighting
ST-ASS
ASS/SSA subtitles syntax highlight for Sublime Text.
Stars: ✭ 23 (-99.05%)
Mutual labels:  syntax-highlighting
kirby-highlight
Themeable server-side syntax highlighting for Kirby
Stars: ✭ 14 (-99.42%)
Mutual labels:  syntax-highlighting
Sublime-GameMaker-Studio-Language-Bundle
A sublime bundle for GameMaker Language (GML)
Stars: ✭ 32 (-98.68%)
Mutual labels:  syntax-highlighting
Squircle-IDE
👨‍💻 Squircle CE is a fast and free multi-language code editor for Android
Stars: ✭ 642 (-73.5%)
Mutual labels:  syntax-highlighting

git-split-diffs

GitHub style split (side by side) 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 14 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 -RFX

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

You can disable this with the highlight-line-changes setting:

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

Enable scrolling in the terminal

git config --global core.pager "git-split-diffs --color | less -+LFX"

(note the difference from the main configuration with the added + to the less command)

Syntax highlighting

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

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

The supported syntax highlighting themes are listed at https://github.com/shikijs/shiki/blob/v0.9.3/docs/themes.md

You can disable syntax highlighting by setting the name to empty:

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

Narrow terminals

Split diffs can be hard to read on narrow terminals, so we revert to unified diffs if we cannot fit two lines of min-line-width on screen. 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-name arctic

Screenshot of GitHub Dark (Dim) theme

Dark

This is the default theme.

git config split-diffs.theme-name dark

Screenshot of dark theme

Light

git config split-diffs.theme-name light

Screenshot of light theme

GitHub Dark (Dim)

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

Screenshot of GitHub Dark (Dim) theme

GitHub Light

git config split-diffs.theme-name github-light

Screenshot of GitHub Light theme

Solarized Dark

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

git config split-diffs.theme-name solarized-dark

Screenshot of Solarized Dark theme

Solarized Light

git config split-diffs.theme-name solarized-light

Screenshot of Solarized Light theme

Monochrome Dark

git config split-diffs.theme-name monochrome-dark

Screenshot of Monochrome Dark theme

Monochrome Light

git config split-diffs.theme-name monochrome-light

Screenshot of Monochrome Light theme

Performance

Tested by measuring the time it took to pipe the output git log -p to /dev/null via git-split-diffs with the default theme:

Features enabled ms/kloc
Everything 4661
No syntax highlighting 40
No syntax highlighting, no inline change highlighting 34

1 shikijs/shiki#151 improves this to 333ms/kloc

Troubleshooting

Not seeing diffs side-by-side?

See #narrow-terminals

Not seeing colors, or seeing fewer colors?

Text coloring is implemented using Chalk which supports various levels of color. If Chalk is producing fewer colors than your terminal supports, try overriding Chalk's detection using a variation of the --color flag, e.g. --color=16m for true color. See Chalk's documentation or this useful gist on terminal support if issues persist.

Acknowledgements

  • diff-so-fancy for showing what's possible
  • shikijs for making it easy to do high quality syntax highlighting
  • chalk for making it easy to do terminal styling reliably
  • delta which approaches the same problem in Rust
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].