blob: e76b151c19d2b86c2efb0b407ec989e33dea3de5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env bash
# Description: Show diff of 2 directories or multiple files in vimdiff
#
# Shell: Bash
# Author: Arun Prakash Jana
selection=~/.config/nnn/.selection
if [ -s $selection ]; then
arr=$(cat $selection | tr '\0' '\n')
{ read -r f1; read -r f2; } <<< "$arr"
if [ -z "$f2" ]; then
exit
fi
if [ -d "$f1" ] && [ -d "$f2" ]; then
vimdiff <(cd "$f1" && find | sort) <(cd "$f2" && find | sort)
else
cat $selection | xargs -0 -o vimdiff
# For GNU xargs (note: ignoreme takes up $0)
# cat $selection | xargs -0 bash -c '</dev/tty vimdiff "$@"' ignoreme
fi
fi
|