├── Commands
├── Active File With Arbitrary File….tmCommand
├── Apply Patch from Clipboard.tmCommand
├── Apply Patch.tmCommand
├── Diff Buffer With Clipboard.plist
├── Diff Selected Files (Simple).plist
├── Diff Selected Files.plist
├── Diff With File on Disk.plist
├── Merge Selected Files.plist
└── Statistics (Lines Added:Removed).plist
├── Macros
├── Find Next Conflict.tmMacro
├── Replace Conflict With Newer Text.tmMacro
└── Replace Conflict With Older Text.tmMacro
├── Preferences
├── Folding Patterns.tmPreferences
├── Markup style: Changed.plist
├── Markup style: Deleted.plist
├── Markup style: Diff metadata.plist
├── Markup style: Header.plist
├── Markup style: Inserted.plist
├── Markup style: Range.plist
└── Symbol List: Indent Ranges.plist
├── README.mdown
├── Support
├── Diff.pl
├── both-hide.css
├── both-show.css
├── diff-norm.css
├── diff-rev.css
├── diff.css
├── flip_files.js
└── styleswitcher.js
├── Syntaxes
└── Diff.plist
└── info.plist
/Commands/Active File With Arbitrary File….tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | file=$(osascript <<"APPLESCRIPT"
12 | tell app "TextMate"
13 | try
14 | set theFile to choose file
15 | set the result to POSIX path of theFile
16 | on error
17 | set the result to ""
18 | end try
19 | end tell
20 | APPLESCRIPT)
21 |
22 | if [[ "$file" == "" ]]; then exit_discard; fi
23 |
24 | if diff --strip-trailing-cr --label "$file" --label "${TM_DISPLAYNAME}" -u "$file" -; then
25 | exit_show_tool_tip "There are no differences."
26 | fi
27 |
28 | input
29 | document
30 | inputFormat
31 | text
32 | keyEquivalent
33 | ^@D
34 | name
35 | Document With Arbitrary File…
36 | outputCaret
37 | afterOutput
38 | outputFormat
39 | text
40 | outputLocation
41 | newWindow
42 | semanticClass
43 | diff.document
44 | uuid
45 | 4050A252-C604-4D0C-8545-E50B22E2715B
46 | version
47 | 2
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Commands/Apply Patch from Clipboard.tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | export PATCH_GET=0
12 |
13 | if [[ -z $TM_FILEPATH ]]
14 | then exit_discard
15 | else pbpaste | patch "$TM_FILEPATH" -p0
16 | fi
17 |
18 | fallbackInput
19 | none
20 | input
21 | selection
22 | inputFormat
23 | text
24 | keyEquivalent
25 | ^@D
26 | name
27 | Apply Patch From Clipboard to Current Document
28 | outputCaret
29 | afterOutput
30 | outputFormat
31 | text
32 | outputLocation
33 | toolTip
34 | semanticClass
35 | diff.files
36 | uuid
37 | 46842464-574C-477F-9DFB-BB38EA3C85BE
38 | version
39 | 2
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Commands/Apply Patch.tmCommand:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | # patch may be the most brainfucked standard Unix tool ever. Make sure it doesn't try to access the network (it tends to ignore the -g option, I find) -- if you have Perforce installed, this can be a huge performance hit -- and it touches the network even for files that aren't controlled by Perforce. All files on the system get the lovely 'is this file locked'? treatment. Software tools, huh?
12 |
13 | export PATCH_GET=0
14 |
15 | path=$(osascript<<END
16 | tell application "TextMate"
17 | set theFile to choose folder with prompt "Where should I look for files to be patched?"
18 | set the result to POSIX path of theFile
19 | end tell
20 | END)
21 |
22 | if [[ -z $path ]]; then
23 | exit_discard
24 | else
25 | patch -d "$path" -p0
26 | fi
27 |
28 | input
29 | document
30 | inputFormat
31 | text
32 | keyEquivalent
33 | ^@D
34 | name
35 | Apply Patch to Files…
36 | outputCaret
37 | afterOutput
38 | outputFormat
39 | text
40 | outputLocation
41 | toolTip
42 | semanticClass
43 | diff.files
44 | uuid
45 | 54D1CEF2-10AB-407B-AAB2-6AEA06B297B1
46 | version
47 | 2
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Commands/Diff Buffer With Clipboard.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | if diff --strip-trailing-cr --label "${TM_DISPLAYNAME}" --label "(clipboard)" -u - <(pbpaste); then
12 | echo "There are no differences."
13 | else
14 | exit_create_new_document
15 | fi
16 |
17 | input
18 | selection
19 | inputFormat
20 | text
21 | keyEquivalent
22 | ^@D
23 | name
24 | Document / Selection With Clipboard
25 | outputCaret
26 | afterOutput
27 | outputFormat
28 | text
29 | outputLocation
30 | toolTip
31 | semanticClass
32 | diff.document
33 | uuid
34 | 674E54F5-065E-4224-9626-673903B7C0E0
35 | version
36 | 2
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Commands/Diff Selected Files (Simple).plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | eval arr=("$TM_SELECTED_FILES")
12 | if [[ ${#arr[@]} != 2 ]]; then
13 | exit_show_tool_tip $'You need to select exactly two\nfiles in the project drawer.'
14 | fi
15 |
16 | if eval diff -u "$TM_SELECTED_FILES"; then
17 | exit_show_tool_tip "There are no differences."
18 | fi
19 |
20 | input
21 | none
22 | inputFormat
23 | text
24 | keyEquivalent
25 | ^@D
26 | name
27 | Selected Files in Project Drawer
28 | outputCaret
29 | afterOutput
30 | outputFormat
31 | text
32 | outputLocation
33 | newWindow
34 | semanticClass
35 | diff.files
36 | uuid
37 | D04AFBD3-8110-11D9-8E5B-0011242E4184
38 | version
39 | 2
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Commands/Diff Selected Files.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | eval arr=("$TM_SELECTED_FILES")
12 | if [[ ${#arr[@]} != 2 ]]; then
13 | echo -e "You need to select exactly two files in the project drawer."
14 | exit_show_tool_tip
15 | fi
16 |
17 | perl "$TM_BUNDLE_SUPPORT/Diff.pl"
18 |
19 | input
20 | none
21 | inputFormat
22 | text
23 | keyEquivalent
24 | ^@D
25 | name
26 | Selected Files in Project Drawer (HTML)
27 | outputCaret
28 | afterOutput
29 | outputFormat
30 | html
31 | outputLocation
32 | newWindow
33 | semanticClass
34 | diff.files
35 | uuid
36 | 6A811265-81DC-11D9-9AA2-000D9332809C
37 | version
38 | 2
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Commands/Diff With File on Disk.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | if [[ ! -e "$TM_FILEPATH" ]]; then
12 | exit_show_tool_tip "There is no file on disk"
13 | fi
14 |
15 | if diff --strip-trailing-cr --label "$TM_FILENAME (saved version)" --label "(current document)" -u "$TM_FILEPATH" -; then
16 | exit_show_tool_tip "There are no differences."
17 | fi
18 |
19 | input
20 | document
21 | inputFormat
22 | text
23 | keyEquivalent
24 | ^@D
25 | name
26 | Document With Saved Copy
27 | outputCaret
28 | afterOutput
29 | outputFormat
30 | text
31 | outputLocation
32 | newWindow
33 | semanticClass
34 | diff.document
35 | uuid
36 | 0979659D-126E-467F-AC07-599979A42D67
37 | version
38 | 2
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Commands/Merge Selected Files.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | eval arr=("$TM_SELECTED_FILES")
12 | if [[ ${#arr[@]} == 2 ]];
13 | then ${TM_OPENDIFF:-opendiff} "${arr[0]}" "${arr[1]}"
14 | else echo -e "You need to select exactly two\nfiles in the project drawer."
15 | fi
16 |
17 | input
18 | none
19 | inputFormat
20 | text
21 | keyEquivalent
22 | ^@D
23 | name
24 | Merge Selected Files…
25 | outputCaret
26 | afterOutput
27 | outputFormat
28 | text
29 | outputLocation
30 | toolTip
31 | requiredCommands
32 |
33 |
34 | command
35 | opendiff
36 | locations
37 |
38 | /usr/bin/opendiff
39 |
40 | variable
41 | TM_OPENDIFF
42 |
43 |
44 | semanticClass
45 | diff.files
46 | uuid
47 | 239E196A-7106-4DC9-8FAE-0A9CA7540AFA
48 | version
49 | 2
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Commands/Statistics (Lines Added:Removed).plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | beforeRunningCommand
6 | nop
7 | command
8 | #!/usr/bin/env bash
9 | [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh"
10 |
11 | egrep -v '^(\+\+\+|---) '|\
12 | tee >(add=$(grep ^+|wc -l); echo 1>&2 "Lines Added $add") \
13 | |{ rem=$(grep ^-|wc -l); wait; echo "Lines Removed $rem"; }
14 |
15 | input
16 | document
17 | inputFormat
18 | text
19 | keyEquivalent
20 | ^N
21 | name
22 | Statistics (Lines Added/Removed)
23 | outputCaret
24 | afterOutput
25 | outputFormat
26 | text
27 | outputLocation
28 | toolTip
29 | scope
30 | source.diff
31 | semanticClass
32 | diff.document
33 | uuid
34 | B9091553-4317-415E-B381-4609BD453E01
35 | version
36 | 2
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Macros/Find Next Conflict.tmMacro:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | commands
6 |
7 |
8 | argument
9 |
10 | action
11 | findNext
12 | findString
13 | ^(?=<<<<<<<)
14 | regularExpression
15 |
16 | wrapAround
17 |
18 |
19 | command
20 | findWithOptions:
21 |
22 |
23 | keyEquivalent
24 | ^|
25 | name
26 | Find Next Conflict
27 | scope
28 | attr.scm.status.conflicted,
29 | scopeType
30 | local
31 | uuid
32 | 7494B11B-2A67-4BAD-B652-40205D354423
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Macros/Replace Conflict With Newer Text.tmMacro:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | commands
6 |
7 |
8 | argument
9 |
10 | action
11 | findNext
12 | findString
13 | (?m:<<<<<<<[^\n]*?\n(.*?\n?)=======\n(.*?\n?)>>>>>>>([^\n]*)\n)
14 | regularExpression
15 |
16 | wrapAround
17 |
18 |
19 | command
20 | findWithOptions:
21 |
22 |
23 | argument
24 |
25 | action
26 | replace
27 | findString
28 | (?m:<<<<<<<[^\n]*?\n(.*?\n?)=======\n(.*?\n?)>>>>>>>([^\n]*)\n)
29 | regularExpression
30 |
31 | replaceAllScope
32 | document
33 | replaceString
34 | $2
35 | wrapAround
36 |
37 |
38 | command
39 | findWithOptions:
40 |
41 |
42 | keyEquivalent
43 | ^}
44 | name
45 | Replace Conflict With Newer Text
46 | scope
47 | attr.scm.status.conflicted,
48 | scopeType
49 | local
50 | uuid
51 | 792B95BE-0CD5-4AC1-854A-901E7DD5AA30
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Macros/Replace Conflict With Older Text.tmMacro:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | commands
6 |
7 |
8 | argument
9 |
10 | action
11 | findNext
12 | findString
13 | (?m:<<<<<<<[^\n]*?\n(.*?\n?)=======\n(.*?\n?)>>>>>>>([^\n]*)\n)
14 | regularExpression
15 |
16 | wrapAround
17 |
18 |
19 | command
20 | findWithOptions:
21 |
22 |
23 | argument
24 |
25 | action
26 | replace
27 | findString
28 | (?m:<<<<<<<[^\n]*?\n(.*?\n?)=======\n(.*?\n?)>>>>>>>([^\n]*)\n)
29 | regularExpression
30 |
31 | replaceAllScope
32 | document
33 | replaceString
34 | $1
35 | wrapAround
36 |
37 |
38 | command
39 | findWithOptions:
40 |
41 |
42 | keyEquivalent
43 | ^{
44 | name
45 | Replace Conflict With Older Text
46 | scope
47 | attr.scm.status.conflicted,
48 | scopeType
49 | local
50 | uuid
51 | 2A82E9A1-A70E-4268-86DF-A20C12D2FA01
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Preferences/Folding Patterns.tmPreferences:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Folding Patterns
7 | scope
8 | source.diff
9 | settings
10 |
11 | foldingIndentedBlockIgnore
12 | ^[-+!<> ]
13 | foldingIndentedBlockStart
14 | ^(@@ |\d+[acd]\d+|diff )
15 |
16 | uuid
17 | 9B46F71B-3813-4F2E-AD9C-D4C6FAAFC169
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Preferences/Markup style: Changed.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Style: Changed
7 | scope
8 | markup.changed
9 | settings
10 |
11 | background
12 | #F5C411
13 | foreground
14 | #FFFFFF
15 |
16 | uuid
17 | EB0FD215-C2EE-4576-86FD-ABA3EDCB5A7B
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Preferences/Markup style: Deleted.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Style: Deleted
7 | scope
8 | markup.deleted
9 | settings
10 |
11 | background
12 | #FF3D3D
13 | foreground
14 | #FFFFFF
15 |
16 | uuid
17 | FFF345C5-D3B4-4975-A610-69CC645FEE7C
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Preferences/Markup style: Diff metadata.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Style: Index
7 | scope
8 | meta.diff.index
9 | settings
10 |
11 | background
12 | #3467D1
13 | fontStyle
14 | italic
15 | foreground
16 | #FFFFFF
17 |
18 | uuid
19 | F9C2B477-B6F7-4951-953B-32BFEF121F7C
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Preferences/Markup style: Header.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Style: Header
7 | scope
8 | meta.diff.header
9 | settings
10 |
11 | background
12 | #5685E3
13 | foreground
14 | #FFFFFF
15 |
16 | uuid
17 | ED5636AE-09EF-46C4-A4F8-B88F701763E2
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Preferences/Markup style: Inserted.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Style: Inserted
7 | scope
8 | markup.inserted
9 | settings
10 |
11 | background
12 | #73FF65
13 | foreground
14 | #000000
15 |
16 | uuid
17 | 7D036841-43BD-49CA-892F-0A6837EF8FB7
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Preferences/Markup style: Range.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Style: Range
7 | scope
8 | meta.diff.range
9 | settings
10 |
11 | background
12 | #3467D1
13 | fontStyle
14 | italic
15 | foreground
16 | #FFFFFF
17 |
18 | uuid
19 | 71A420A8-0892-4622-BDA4-CC00D98C59E6
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Preferences/Symbol List: Indent Ranges.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | name
6 | Symbol List: Indent Ranges
7 | scope
8 | source.diff meta.diff.range
9 | settings
10 |
11 | comment
12 | Insert (figure space) padding
13 | so that “+nnn,n” becomes “+ nnn, n”
14 | symbolTransformation
15 |
16 | s/[-+](\d)(\d)?(\d)?(\d)?,/(?4:: (?3:: (?2:: )))$0/g;
17 | s/,(\d)\b/, $1/g;
18 | s/^/ /;
19 |
20 |
21 | uuid
22 | A0B3B6D2-59B1-407F-B310-7FA67222B37A
23 |
24 |
25 |
--------------------------------------------------------------------------------
/README.mdown:
--------------------------------------------------------------------------------
1 | # Installation
2 |
3 | You can install this bundle in TextMate by opening the preferences and going to the bundles tab. After installation it will be automatically updated for you.
4 |
5 | # General
6 |
7 | * [Bundle Styleguide](http://kb.textmate.org/bundle_styleguide) — _before you make changes_
8 | * [Commit Styleguide](http://kb.textmate.org/commit_styleguide) — _before you send a pull request_
9 | * [Writing Bug Reports](http://kb.textmate.org/writing_bug_reports) — _before you report an issue_
10 |
11 | # License
12 |
13 | If not otherwise specified (see below), files in this repository fall under the following license:
14 |
15 | Permission to copy, use, modify, sell and distribute this
16 | software is granted. This software is provided "as is" without
17 | express or implied warranty, and with no claim as to its
18 | suitability for any purpose.
19 |
20 | An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”.
--------------------------------------------------------------------------------
/Support/Diff.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 |
3 | # (c) 2005, Eric Hsu
4 |
5 | # To Do
6 | # what's with the 'no ending Newline'?
7 | # Allow merging?
8 | # Allow swapping of old and new
9 | # Allow last diff (if no SELECTED_FILES)
10 | # Allow hiding of common (use CSS)
11 |
12 | # Stylesheet switching from http://old.alistapart.com/stories/alternate/
13 |
14 | my $css = $ENV{'TM_BUNDLE_SUPPORT'};
15 |
16 | my $html = <
18 |
19 |
20 | END
21 |
22 | # $html .= <
24 | #
25 | #
26 | #
27 | #
28 | # END
29 |
30 | $html .= '';
31 |
32 | my $files = $ENV{'TM_SELECTED_FILES'};
33 | $diffout = `diff -s -U99999 $files 2> /dev/null`;
34 |
35 | $diffout =~ s/\n\\ No newline at end of file\n/\n/g;
36 |
37 | ( $OLD1, $OLD2, $NEW1, $NEW2 ) =
38 | ( $files =~ /\'(.*?)([^\\])\'\s+\'(.*?)([^\\])\'/ );
39 | $OLD = $OLD1 . $OLD2;
40 | $NEW = $NEW1 . $NEW2;
41 |
42 | $diffout =~ s/\n\@.*?\n/\n\n/;
43 |
44 | # use HTML::Entities;
45 | # encode_entities($diffout);
46 | $diffout =~ s/&/&/g; # silly; make sure this comes before the next two.
47 | $diffout =~ s/</g;
48 | $diffout =~ s/>/>/g;
49 |
50 | $oldline = $newline = -2;
51 |
52 | foreach ( split( /\n/, $diffout ) ) {
53 | $TMURL = "" ;
57 | }
58 |
59 | if (/^\-/) {
60 | s/^\-(.*)$/$1<\/span>/g;
61 | $oldline++;
62 | $TMURL .= $OLD;
63 | $TMURL .= "&line=" . $oldline if ( $oldline > 0 );
64 | }
65 | elsif (/^\+/) {
66 | s/^\+(.*)$/$1<\/span>/g;
67 | $newline++;
68 | $TMURL .= $NEW;
69 | $TMURL .= "&line=" . $newline if ( $newline > 0 );
70 |
71 | }
72 | else { # this is common text. By default, we jump to the new version.
73 | s/^(.*?)$/$1<\/span>/g;
74 | $newline++;
75 | $oldline++;
76 |
77 | $TMURL .= $NEW;
78 | $TMURL .= "&line=" . $newline if ( $newline > 0 );
79 | }
80 |
81 | $html .= $TMURL . '">' . $_ . "" . "
";
82 | }
83 |
84 | $html .= "