diff options
Diffstat (limited to 'plugins/ndiff')
-rwxr-xr-x | plugins/ndiff | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/ndiff b/plugins/ndiff index fad28ad..46e829a 100755 --- a/plugins/ndiff +++ b/plugins/ndiff @@ -1,8 +1,14 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash -# Description: Show diff using vimdiff +# Description: Show diff of 2 directories or multiple files in vimdiff # -# Shell: POSIX compliant +# Shell: Bash # Author: Arun Prakash Jana -vimdiff $(cat ~/.config/nnn/.selection | tr '\0' '\n') +arr=($(cat ~/.config/nnn/.selection | tr '\0' '\n')) + +if [ -d "${arr[0]}" ] && [ -d "${arr[1]}" ]; then + vimdiff <(cd ${arr[0]} && find | sort) <(cd ${arr[1]} && find | sort) +else + vimdiff "${arr[@]}" +fi |