diff options
author | 2019-05-26 07:36:24 +0530 | |
---|---|---|
committer | 2019-05-26 10:27:09 +0530 | |
commit | d6fbe87768a0893581e3fbad89c43aa2aa839251 (patch) | |
tree | a2c8cf81f15b69e10f364696bbe4e4f74c141bf3 /plugins/ndiff | |
parent | 7bf671c954312f38ab0a457879b9ba159a63bae2 (diff) | |
download | nnn-d6fbe87768a0893581e3fbad89c43aa2aa839251.tar.gz |
Support directory diff
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 |