From 9147a49cf7bd06651f074ed87fd4fb89f57060c1 Mon Sep 17 00:00:00 2001 From: iddoeldor Date: Mon, 10 Jun 2019 14:39:05 +0300 Subject: [PATCH 1/2] vimdiff & diffchar --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 77f190d..a5692c9 100644 --- a/README.md +++ b/README.md @@ -1827,6 +1827,32 @@ diff <(cd directory1 && find | sort) <(cd directory2 && find | sort) ```bash diff <(cat /etc/passwd) <(cut -f2 /etc/passwd) ``` +##### Tool: vimdiff + +##### Highlight the exact differences, based on characters and words + +```sh +vimdiff file1 file2 +``` +Compare two JSON files + +```sh +vimdiff <(jq -S . A.json) <(jq -S . B.json) +``` + +Compare Hex dump +```sh +d(){ vimdiff <(f $1) <(f $2);};f(){ hexdump -C $1|cut -d' ' -f3-|tr -s ' ';}; d ~/bin1 ~/bin2 +``` + +Save [diffchar](https://raw.githubusercontent.com/vim-scripts/diffchar.vim/master/plugin/diffchar.vim) @ `~/.vim/plugins` + +Click `F7` to switch between diff modes + +Usefull vimdiff commands: +* `qa` to exit all windows +* `:vertical resize 70` to resize window +* Set window width `Ctrl+W [N columns]+(Shift+)<\>` ___ From 11a8f7464b0da149851f015bac519d1261f9e236 Mon Sep 17 00:00:00 2001 From: "@trimstray" Date: Mon, 10 Jun 2019 18:29:24 +0200 Subject: [PATCH 2/2] vimdiff: minor updates --- README.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a5692c9..56e23b6 100644 --- a/README.md +++ b/README.md @@ -1232,6 +1232,7 @@ CyberTalks - talks, interviews, and article about cybersecurity.
* [kill](#tool-kill) * [find](#tool-find) * [diff](#tool-diff) + * [vimdiff](#tool-vimdiff) * [tail](#tool-tail) * [cpulimit](#tool-cpulimit) * [pwdx](#tool-pwdx) @@ -1827,29 +1828,35 @@ diff <(cd directory1 && find | sort) <(cd directory2 && find | sort) ```bash diff <(cat /etc/passwd) <(cut -f2 /etc/passwd) ``` -##### Tool: vimdiff + +___ + +##### Tool: [vimdiff](http://vimdoc.sourceforge.net/htmldoc/diff.html) ##### Highlight the exact differences, based on characters and words -```sh +```bash vimdiff file1 file2 ``` -Compare two JSON files +###### Compare two JSON files -```sh +```bash vimdiff <(jq -S . A.json) <(jq -S . B.json) ``` -Compare Hex dump -```sh +###### Compare Hex dump +```bash d(){ vimdiff <(f $1) <(f $2);};f(){ hexdump -C $1|cut -d' ' -f3-|tr -s ' ';}; d ~/bin1 ~/bin2 ``` +###### diffchar + Save [diffchar](https://raw.githubusercontent.com/vim-scripts/diffchar.vim/master/plugin/diffchar.vim) @ `~/.vim/plugins` Click `F7` to switch between diff modes -Usefull vimdiff commands: +Usefull `vimdiff` commands: + * `qa` to exit all windows * `:vertical resize 70` to resize window * Set window width `Ctrl+W [N columns]+(Shift+)<\>`