瀏覽代碼

Make diff work with filenames with spaces

master
Arun Prakash Jana 5 年之前
父節點
當前提交
aa6013378f
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: A75979F35C080412
共有 1 個文件被更改,包括 17 次插入5 次删除
  1. +17
    -5
      plugins/ndiff

+ 17
- 5
plugins/ndiff 查看文件

@@ -5,10 +5,22 @@
# Shell: Bash # Shell: Bash
# Author: Arun Prakash Jana # Author: Arun Prakash Jana


arr=($(cat ~/.config/nnn/.selection | tr '\0' '\n')) selection=~/.config/nnn/.selection


if [ -d "${arr[0]}" ] && [ -d "${arr[1]}" ]; then if [ -s $selection ]; then
vimdiff <(cd ${arr[0]} && find | sort) <(cd ${arr[1]} && find | sort) arr=$(cat $selection | tr '\0' '\n')
else { read -r f1; read -r f2; } <<< "$arr"
vimdiff "${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 fi

||||||
x
 
000:0
Loading…
取消
儲存