will133 / vim-dirdiff

Vim plugin to diff two directories
335 stars 59 forks source link

Incompatibility with set hidden #35

Open Dupond opened 3 years ago

Dupond commented 3 years ago

Hello,

I use neovim 0.4.4 (in Arch Linux). I have the following alias defined in my .bashrc to automatically use your plugin when two folders are compared:

function __vimdiff {
    if [ -d "$1" ] && [ -d "$2" ] && [ -z "$3" ]; then
        /usr/bin/nvim -c "DirDiff $1 $2"
    else
        /usr/bin/nvim -d "$@"
    fi
}
alias vimdiff="__vimdiff"

Now, I'm experiencing a strange behaviour: if set hidden is NOT set in my init.vim file, then DirDiff works just fine; but if I set this option, then DirDiff always shows the content of the first file of the diff: when I hit the Enter key on any other file name (e.g. a file "Only in [A]"), DirDiff doesn't show its content.

I don't experience this when I launch :DirDiff dir1 dir2 from neovim itself, whether set hidden is set or not.

Is there an explanation for this? Could anyone explain me why this set hidden option could influence the behaviour of vim-dirdiff? Thanx for any help!

will133 commented 3 years ago

I tried this on a Mac with nvim 0.4.4 (installed with brew) and I don't seem to see this problem. I tried to do a nvim -c "DirDiff d1 d2" and I tried this with both set hidden or not but I can't seem reproduce this. Have you tried this with different platform/nvim and see whether it's a nvim specific problem?

Dupond commented 3 years ago

I have the same result with vim. But I've investigated a bit further, and it appears that this set hidden problem only appears when the first element of the first directory is also a directory: let's say that d1 contains several directories and several files; if the first name in the list is a directory (e.g. name it .my_folder in a directory where there is no other hidden file), then the problem occurs.

Once again I only encounter this problem with the alias, not with a direct :DirDiff d1 d2 inside vim.

So, I hadn't realized that it was so specific when I opened this issue; now I understand that (if it's a bug, which is still not sure at all) it's such a minor bug that I probably shouldn't have bothered you with this... Don't know if you'll be able to reproduce it. In any case, please feel free to close this issue, of course.

And by the way, thanx for this great plugin! I love it!