gioele / vim-autoswap

Please Vim, stop with these swap file messages. Just switch to the correct window!
Creative Commons Zero v1.0 Universal
115 stars 25 forks source link

Plugin mistakenly identifies files with the same name in different directories as identical #18

Open clinta opened 6 years ago

clinta commented 6 years ago

I tried working around this with set titlestring=%{expand(\"%:p:h\")} in my vimrc, but this did not solve the issue.

djvs commented 5 years ago

Same problem.

djvs commented 5 years ago

I got it working with:

set titlestring=vi\:\ %-25.55F\ %a%r%m titlelen=70

Good enough for me.

jflorian commented 5 years ago

Seems like any solution for this is going to need to use readlink -f FILENAME (on Linux) to handle this case correctly. Consider the following:

gvim ../foo
cd ..
gvim foo

Here we have two different names given to gvim, but for the same file. Using readlink -f to get the canonical path will ensure the equality test is accurate. Granted $SUBJECT is about two different files and I'm describing two references to the same file, but I believe it still applies and simplifies how the fix should work.

It appears from testing that vim's fnamemodify function does yield the canonical path when given the :p option. So that makes a good platform-agnostic solution here.