22
33Two-way file comparison for Textadept.
44
5- Install this module by copying it into your * ~ /.textadept/modules/* directory
6- or Textadept's * modules/* directory, and then putting the following in your
7- * ~ /.textadept/init.lua* :
5+ Install this module by copying it into your * ~ /.textadept/modules/* directory or Textadept's
6+ * modules/* directory, and then putting the following in your * ~ /.textadept/init.lua* :
87
98 require('file_diff')
109
1110## Usage
1211
1312A sample workflow is this:
1413
15- 1 . Start comparing two files via the "Compare Files" submenu in the "Tools"
16- menu.
14+ 1 . Start comparing two files via the "Compare Files" submenu in the "Tools" menu.
17152 . The caret is initially placed in the file on the left.
18163 . Go to the next change via menu or key binding.
19- 4 . Merge the change from the other buffer into the current one (right to
20- left) via menu or key binding.
17+ 4 . Merge the change from the other buffer into the current one (right to left) via menu or
18+ key binding.
21195 . Go to the next change via menu or key binding.
22- 6 . Merge the change from the current buffer into the other one (left to
23- right) via menu or key binding.
20+ 6 . Merge the change from the current buffer into the other one (left to right) via menu or
21+ key binding.
24227 . Repeat as necessary.
2523
26- Note: merging can be performed wherever the caret is placed when jumping
27- between changes, even if one buffer has a change and the other does not
28- (additions or deletions).
24+ Note: merging can be performed wherever the caret is placed when jumping between changes,
25+ even if one buffer has a change and the other does not (additions or deletions).
2926
3027## Key Bindings
3128
32- Windows, Linux, BSD| macOS| Terminal| Command
33- -------------------|-----|--------|------ -
34- ** Tools** | | |
35- F6 | F6 | F6 | Compare files...
36- Shift+F6 | ⇧F6 | S-F6 | Compare the buffers in two split views
37- Alt+Down | ⌥⇣ | M-Down | Goto next difference
38- Alt+Up | ⌥⇡ | M-Up | Goto previous difference
39- Alt+Left | ⌥⇠ | M-Left | Merge left
40- Alt+Right | ⌥⇢ | M-Right |Merge right
29+ Windows, Linux, BSD | macOS | Terminal | Command
30+ -|-|-| -
31+ ** Tools** | | |
32+ F6 | F6 | F6 | Compare files...
33+ Shift+F6 | ⇧F6 | S-F6 | Compare the buffers in two split views
34+ Alt+Down | ⌥⇣ | M-Down | Goto next difference
35+ Alt+Up | ⌥⇡ | M-Up | Goto previous difference
36+ Alt+Left | ⌥⇠ | M-Left | Merge left
37+ Alt+Right | ⌥⇢ | M-Right | Merge right
4138
4239
4340## Fields defined by ` file_diff `
@@ -71,10 +68,9 @@ The marker for line modifications.
7168### ` file_diff.theme ` (string)
7269
7370The theme to use, either 'dark' or 'light'.
74- This is not the theme used with Textadept.
75- Depending on this setting, additions will be colored 'dark_green' or
76- 'light_green', deletions will be colored 'dark_red' or 'light_red', and so
77- on.
71+ This is not the theme used with Textadept. Depending on this setting, additions will be
72+ colored 'dark_green' or 'light_green', deletions will be colored 'dark_red' or 'light_red',
73+ and so on.
7874 The default value is auto-detected.
7975
8076
@@ -83,11 +79,10 @@ The theme to use, either 'dark' or 'light'.
8379<a id =" _G.diff " ></a >
8480### ` _G.diff ` (* text1, text2* )
8581
86- Returns a list that represents the differences between strings * text1* and
87- * text2* .
88- Each consecutive pair of elements in the returned list represents a "diff".
89- The first element is an integer: 0 for a deletion, 1 for an insertion, and 2
90- for equality. The second element is the associated diff text.
82+ Returns a list that represents the differences between strings * text1* and * text2* .
83+ Each consecutive pair of elements in the returned list represents a "diff". The first element
84+ is an integer: 0 for a deletion, 1 for an insertion, and 2 for equality. The second element
85+ is the associated diff text.
9186
9287Parameters:
9388
@@ -106,20 +101,18 @@ Return:
106101<a id =" file_diff.goto_change " ></a >
107102### ` file_diff.goto_change ` (* next* )
108103
109- Jumps to the next or previous difference between the two files depending on
110- boolean * next* .
104+ Jumps to the next or previous difference between the two files depending on boolean * next* .
111105[ ` file_diff.start() ` ] ( #file_diff.start ) must have been called previously.
112106
113107Parameters:
114108
115- * * ` next ` * : Whether to go to the next or previous difference relative to the
116- current line.
109+ * * ` next ` * : Whether to go to the next or previous difference relative to the current line.
117110
118111<a id =" file_diff.merge " ></a >
119112### ` file_diff.merge ` (* left* )
120113
121- Merges a change from one buffer to another, depending on the change under
122- the caret and the merge direction.
114+ Merges a change from one buffer to another, depending on the change under the caret and the
115+ merge direction.
123116
124117Parameters:
125118
@@ -128,18 +121,16 @@ Parameters:
128121<a id =" file_diff.start " ></a >
129122### ` file_diff.start ` (* file1, file2, horizontal* )
130123
131- Highlight differences between files * file1* and * file2* , or the user-selected
132- files.
124+ Highlight differences between files * file1* and * file2* , or the user-selected files.
133125
134126Parameters:
135127
136- * * ` file1 ` * : Optional name of the older file. If ` - ` , uses the current
137- buffer. If ` nil ` , the user is prompted for a file.
138- * * ` file2 ` * : Optional name of the newer file. If ` - ` , uses the current
139- buffer. If ` nil ` , the user is prompted for a file.
140- * * ` horizontal ` * : Optional flag specifying whether or not to split the view
141- horizontally. The default value is ` false ` , comparing the two files
142- side-by-side.
128+ * * ` file1 ` * : Optional name of the older file. If ` - ` , uses the current buffer. If ` nil ` ,
129+ the user is prompted for a file.
130+ * * ` file2 ` * : Optional name of the newer file. If ` - ` , uses the current buffer. If ` nil ` ,
131+ the user is prompted for a file.
132+ * * ` horizontal ` * : Optional flag specifying whether or not to split the view horizontally. The
133+ default value is ` false ` , comparing the two files side-by-side.
143134
144135
145136---
0 commit comments