2
2
3
3
Two-way file comparison for Textadept.
4
4
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* :
8
7
9
8
require('file_diff')
10
9
11
10
## Usage
12
11
13
12
A sample workflow is this:
14
13
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.
17
15
2 . The caret is initially placed in the file on the left.
18
16
3 . 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.
21
19
5 . 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.
24
22
7 . Repeat as necessary.
25
23
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).
29
26
30
27
## Key Bindings
31
28
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
41
38
42
39
43
40
## Fields defined by ` file_diff `
@@ -71,10 +68,9 @@ The marker for line modifications.
71
68
### ` file_diff.theme ` (string)
72
69
73
70
The 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.
78
74
The default value is auto-detected.
79
75
80
76
@@ -83,11 +79,10 @@ The theme to use, either 'dark' or 'light'.
83
79
<a id =" _G.diff " ></a >
84
80
### ` _G.diff ` (* text1, text2* )
85
81
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.
91
86
92
87
Parameters:
93
88
@@ -106,20 +101,18 @@ Return:
106
101
<a id =" file_diff.goto_change " ></a >
107
102
### ` file_diff.goto_change ` (* next* )
108
103
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* .
111
105
[ ` file_diff.start() ` ] ( #file_diff.start ) must have been called previously.
112
106
113
107
Parameters:
114
108
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.
117
110
118
111
<a id =" file_diff.merge " ></a >
119
112
### ` file_diff.merge ` (* left* )
120
113
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.
123
116
124
117
Parameters:
125
118
@@ -128,18 +121,16 @@ Parameters:
128
121
<a id =" file_diff.start " ></a >
129
122
### ` file_diff.start ` (* file1, file2, horizontal* )
130
123
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.
133
125
134
126
Parameters:
135
127
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.
143
134
144
135
145
136
---
0 commit comments