You've already forked vimtabdiff
Compare commits
3 Commits
065ef47b2b
...
main
Author | SHA1 | Date | |
---|---|---|---|
07b847bd3b | |||
3460ccbfb0 | |||
![]() |
bfe5b576a2 |
@@ -24,7 +24,7 @@ You may need to add `~/bin` to your PATH variable if not already done. See [here
|
|||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
```help
|
```help
|
||||||
usage: vimtabdiff.py [-h] [--vim VIM] [--onlydiffs] pathA pathB
|
usage: vimtabdiff.py [-h] [--vim VIM] [--onlydiffs] [--skipmissing] pathA pathB
|
||||||
|
|
||||||
Show diff of files from two directories in vim tabs
|
Show diff of files from two directories in vim tabs
|
||||||
|
|
||||||
@@ -33,9 +33,10 @@ positional arguments:
|
|||||||
pathB
|
pathB
|
||||||
|
|
||||||
options:
|
options:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
--vim VIM vim command to run
|
--vim VIM vim command to run
|
||||||
--onlydiffs only open files where there is a diff
|
--onlydiffs only open files where there is a diff
|
||||||
|
--skipmissing skip non-existent files
|
||||||
```
|
```
|
||||||
|
|
||||||
## Relevant vim tips
|
## Relevant vim tips
|
||||||
|
@@ -32,6 +32,9 @@ def parse_args() -> argparse.Namespace:
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--onlydiffs", help="only open files where there is a diff", action="store_true"
|
"--onlydiffs", help="only open files where there is a diff", action="store_true"
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--skipmissing", help="skip non-existent files", action="store_true"
|
||||||
|
)
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@@ -87,9 +90,10 @@ def main() -> None:
|
|||||||
aPath = a.resolve() if a else os.devnull
|
aPath = a.resolve() if a else os.devnull
|
||||||
bPath = b.resolve() if b else os.devnull
|
bPath = b.resolve() if b else os.devnull
|
||||||
if (
|
if (
|
||||||
args.onlydiffs
|
(args.skipmissing and (not a or not b)) or
|
||||||
and a and b
|
(args.onlydiffs
|
||||||
and open(aPath, mode="rb").read() == open(bPath, mode="rb").read()
|
and a and b
|
||||||
|
and open(aPath, mode="rb").read() == open(bPath, mode="rb").read())
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
print(f"tabedit {aPath} | vsp {bPath}", file=vimCmdFile)
|
print(f"tabedit {aPath} | vsp {bPath}", file=vimCmdFile)
|
||||||
|
Reference in New Issue
Block a user