Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orbitalquark/textadept-file-diff
Two-way file comparison module for Textadept.
https://github.com/orbitalquark/textadept-file-diff
file-compare file-comparison file-diff textadept textadept-module
Last synced: 3 months ago
JSON representation
Two-way file comparison module for Textadept.
- Host: GitHub
- URL: https://github.com/orbitalquark/textadept-file-diff
- Owner: orbitalquark
- License: mit
- Created: 2020-10-06T20:53:58.000Z (about 4 years ago)
- Default Branch: default
- Last Pushed: 2023-12-31T17:17:44.000Z (10 months ago)
- Last Synced: 2024-05-11T00:36:33.596Z (6 months ago)
- Topics: file-compare, file-comparison, file-diff, textadept, textadept-module
- Language: Lua
- Homepage:
- Size: 104 KB
- Stars: 12
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# File Diff
Two-way file comparison for Textadept.
Install this module by copying it into your *~/.textadept/modules/* directory or Textadept's
*modules/* directory, and then putting the following in your *~/.textadept/init.lua*:require('file_diff')
## Compiling
Releases include binaries, so building this modules should not be necessary. If you want
to build manually, use CMake. For example:cmake -S . -B build_dir
cmake --build build_dir --target diff
cmake --install build_dir## Usage
A sample workflow is this:
1. Start comparing two files via the "Compare Files" submenu in the "Tools" menu.
2. The caret is initially placed in the file on the left.
3. Go to the next change via menu or key binding.
4. Merge the change from the other buffer into the current one (right to left) via menu or
key binding.
5. Go to the next change via menu or key binding.
6. Merge the change from the current buffer into the other one (left to right) via menu or
key binding.
7. Repeat as necessary.Note: merging can be performed wherever the caret is placed when jumping between changes,
even if one buffer has a change and the other does not (additions or deletions).## Key Bindings
Windows and Linux | macOS | Terminal | Command
-|-|-|-
**Tools**| | |
F6 | F6 | None | Compare files...
Shift+F6 | ⇧F6 | None | Compare the buffers in two split views
Ctrl+F6 | ⌘F6 | None | Stop comparing
Ctrl+Alt+. | ^⌘. | None | Goto next difference
Ctrl+Alt+, | ^⌘, | None | Goto previous difference
Ctrl+Alt+< | ^⌘< | None | Merge left
Ctrl+Alt+> | ^⌘> | None | Merge right## Fields defined by `file_diff`
### `file_diff.INDIC_ADDITION`The indicator number for text added within lines.
### `file_diff.INDIC_DELETION`The indicator number for text deleted within lines.
The marker for line additions.
The marker for line deletions.
### `file_diff.MARK_MODIFICATION`The marker for line modifications.
### `file_diff.addition_color_name`The name of the theme color used to mark additions.
The default value is 'green'. If your theme does not define that color, set this field to
your theme's equivalent.
### `file_diff.deletion_color_name`The name of the theme color used to mark deletions.
The default value is 'red'. If your theme does not define that color, set this field to your
theme's equivalent.
### `file_diff.modification_color_name`The name of the theme color used to mark modifications.
The default value is 'yellow'. If your theme does not define that color, set this field to
your theme's equivalent.## Functions defined by `file_diff`
### `_G.diff`(*text1*, *text2*)Returns a list that represents the differences between strings *text1* and *text2*.
Each consecutive pair of elements in the returned list represents a "diff". The first element
is an integer: 0 for a deletion, 1 for an insertion, and 2 for equality. The second element
is the associated diff text.Parameters:
- *text1*: String to compare against.
- *text2*: String to compare.Usage:
- `diffs = diff(text1, text2)
for i = 1, #diffs, 2 do print(diffs[i], diffs[i + 1]) end
`Return:
- list of differences
### `file_diff.goto_change`(*next*)Jumps to the next or previous difference between the two files depending on boolean *next*.
[`file_diff.start()`](#file_diff.start) must have been called previously.Parameters:
- *next*: Whether to go to the next or previous difference relative to the current line.
Merges a change from one buffer to another, depending on the change under the caret and the
merge direction.Parameters:
- *left*: Whether to merge from right to left or left to right.
### `file_diff.start`(*file1*, *file2*, *horizontal*)Highlight differences between files *file1* and *file2*, or the user-selected files.
Parameters:
- *file1*: Optional name of the older file. If `-`, uses the current buffer. If `nil`,
the user is prompted for a file.
- *file2*: Optional name of the newer file. If `-`, uses the current buffer. If `nil`,
the user is prompted for a file.
- *horizontal*: Optional flag specifying whether or not to split the view horizontally. The
default value is `false`, comparing the two files side-by-side.---