Skip to content

Commit

Permalink
[Diff] Side-by-side diff
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelblyons committed Dec 18, 2024
1 parent d13e9fb commit e94d9b7
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Diff/Diff.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ contexts:
- include: diff-deltas
- include: diff3-edit
- include: diff3-normal
- include: side-by-side

###[ HEADERS ]#################################################################

Expand Down Expand Up @@ -313,6 +314,32 @@ contexts:
- match: ^(?:{{conflict_any}})
scope: invalid.illegal.conflict.diff

###[ SIDE-BY-SIDE ]############################################################

# https://www.gnu.org/software/diffutils/manual/diffutils.html#Side-by-Side
side-by-side:
- match: ^(.*) (<)$
captures:
1: markup.deleted.diff
2: punctuation.definition.deleted.diff
- match: ^(.*) (\()$
captures:
1: comment.line.diff
2: punctuation.definition.deleted.diff
- match: ^(.*) ([\\|/]) (.*)$
captures:
1: markup.changed.diff
2: punctuation.definition.changed.diff
3: markup.changed.diff
- match: '^ {4,}(>)(?: (.*))?$'
captures:
1: punctuation.definition.inserted.diff
2: markup.inserted.diff
- match: '^ {4,}(\))(?: (.*))?$'
captures:
1: punctuation.definition.inserted.diff
2: comment.line.diff

###############################################################################

variables:
Expand Down
33 changes: 33 additions & 0 deletions Diff/tests/syntax_test_diff.diff
Original file line number Diff line number Diff line change
Expand Up @@ -562,3 +562,36 @@ hello()
\^^^^^^^^^^^^^^^^ meta.block.conflict.diff
\^^^^^^ punctuation.section.block.end.diff
\ ^^^^^^^^^ entity.name.section.diff


\ https://www.gnu.org/software/diffutils/manual/diffutils.html#Example-Side-by-Side
The Way that can be told of is n <
\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
\ ^ punctuation.definition.deleted.diff
The name that can be named is no <
\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.deleted.diff
\ ^ punctuation.definition.deleted.diff
The Nameless is the origin of He The Nameless is the origin of He
\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - markup
The Named is the mother of all t | The named is the mother of all t
\^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.changed.diff
\ ^ punctuation.definition.changed.diff
\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.changed.diff
>
\ ^ punctuation.definition.inserted.diff
Therefore let there always be no Therefore let there always be no
so we may see their subtlety, so we may see their subtlety,
And let there always be being, And let there always be being,
so we may see their outcome. so we may see their outcome.
The two are the same, The two are the same,
But after they are produced, But after they are produced,
they have different names. they have different names.
> They both may be called deep and
\ ^ punctuation.definition.inserted.diff
\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.inserted.diff
> Deeper and more profound,
\ ^ punctuation.definition.inserted.diff
\ ^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.inserted.diff
> The door of all subtleties!
\ ^ punctuation.definition.inserted.diff
\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ markup.inserted.diff

0 comments on commit e94d9b7

Please sign in to comment.