From da9eb32e363c0d7cd49b3304b36096b935ed0a2c Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Sat, 10 Dec 2022 19:40:11 -0500 Subject: [PATCH] update README --- README.md | 41 ++++++++++++++++++++++++++++++++++++++--- vimtabdiff.py | 4 ++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dfa0d23..93e2351 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,25 @@ +Do you use `git difftool` to review changes before making a commit? The problem with that is that you get to see the diff of one file at a time. You can't easily stop it after few files and you can't go back to a previous file. `vimtabdiff.py` loads all the files with diffs, one in each vim tab page. You can move around any file and edit the diffs easily. + + +# Install + + mkdir -p ~/bin + + # for python version >= 3.10 + curl -o ~/bin/vimtabdiff.py "https://raw.githubusercontent.com/balki/vimtabdiff/master/vimtabdiff.py" + + # for python version < 3.10 + curl -o ~/bin/vimtabdiff.py "https://raw.githubusercontent.com/balki/vimtabdiff/py38/vimtabdiff.py" + + chmod +x ~/bin/vimtabdiff.py + +You may need to add `~/bin` to your PATH variable if not already done. See [here](needed://wiki.archlinux.org/title/Environment_variables#Per_user) for help +👍 this [issue](https://github.com/balki/vimtabdiff/issues/1) for `pip install` support + + +# Screenshot +![image](https://user-images.githubusercontent.com/189196/206880555-c71b472c-144c-4c82-a4ab-f8a4fd36f7a5.png) + # Usage ```help usage: vimtabdiff.py [-h] [--vim VIM] pathA pathB @@ -13,7 +35,20 @@ --vim VIM vim command to run ``` -# Git difftool +## Relevant vim tips + +`gt` → Go to next tab +`gT` → Go to previous tab +`:tabr` → Go to first tab +`:drop filenam` → Go to the tab with filename +`g` → Go to last used tab (Works in vim version > 8.2.1401) +`set mouse` → Now clicking on a tab works +`]c` → Go to next diff hunk +`[c` → Go to previous diff hunk +`do`, `dp` → Diff obtain, Diff put +`zo`, `zc`, `zR` → Fold open, Fold close, open all folds + +# See Git diffs ## Setup @@ -51,10 +86,10 @@ Git config file (`~/.gitconfig`) should look like this # Known issues - 1. If your path to custom vim has space, it does not work. i.e. Following does **not** work + 1. If your path to vim has a space, it does not work, i.e. Following does **not** work ```bash - git config --global difftool.vimtabdiff.cmd 'vimtabdiff.py --vim "/home/foo/my files/bin/vim" $LOCAL $REMOTE' + git config difftool.vimtabdiff.cmd 'vimtabdiff.py --vim "/home/foo/my program files/bin/vim" $LOCAL $REMOTE' ``` 2. Not tested in non-linux OS. Pull requests welcome if found any issues but hopefully should work fine. diff --git a/vimtabdiff.py b/vimtabdiff.py index 490005b..2feb79b 100755 --- a/vimtabdiff.py +++ b/vimtabdiff.py @@ -1,5 +1,9 @@ #!/usr/bin/python3 +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + import os import argparse import itertools