[vim/vim] Can't load tag file with absolute path on Windows. (#8380)

13 views
Skip to first unread message

zoumi

unread,
Jun 14, 2021, 4:45:38 AM6/14/21
to vim/vim, Subscribed

Describe the bug
I have set the tag file path with a absolute path, but gvim can't not find it.

To Reproduce
Detailed steps to reproduce the behavior:

  1. create a tag file: C:\Users\zoumi.cache\HYtags
  2. set tag file path for vim:
:setl tags+=C:\Users\zoumi\.cache\HYtags,tags
  1. check the file exist:
echo filereadable('C:\Users\zoumi\.cache\HYtags')
  1. check if vim can find this tag file
echo tagfiles()      "return 1

Expected behavior
echo tagfiles() should get ['C:\Users\zoumi.cache\HYtags'], but it return []

Environment (please complete the following information):

  • Vim version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun 13 2021 22:02:46)
MS-Windows 64-bit GUI version with OLE support
Included patches: 1-2994
Compiled by appveyor@APPVYR-WIN
  • OS: Windows 10 64bit
  • Terminal: GUI


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

lacygoill

unread,
Jun 14, 2021, 4:58:00 AM6/14/21
to vim/vim, Subscribed

Untested but try to double the backslashes:

:setl tags+=C:\\Users\\zoumi\\.cache\\HYtags,tags
              ^^     ^^     ^^      ^^

Or use :let:

:let &l:tags = &l:tags .. ',' .. 'C:\Users\zoumi\.cache\HYtags,tags'

See :h option-backslash.

zoumi

unread,
Jun 14, 2021, 5:02:32 AM6/14/21
to vim/vim, Subscribed

:setl tags+=C:\Users\zoumi\.cache\HYtags,tags

and

:setl tags+=C:\\Users\\zoumi\\.cache\\HYtags,tags

both get:
echo &tags:
C:\Users\zoumi.cache\HYtags,tags

lacygoill

unread,
Jun 14, 2021, 5:08:54 AM6/14/21
to vim/vim, Subscribed

Ah right. On Windows, backslashes are not removed contrary to Linux:

For Win32 backslashes in file names are mostly not removed. More precise: For
options that expect a file name (those where environment variables are
expanded) a backslash before a normal file name character is not removed. But
a backslash before a special character (space, backslash, comma, etc.) is used
like explained above.

Gary Johnson

unread,
Jun 14, 2021, 12:27:01 PM6/14/21
to reply+ACY5DGADWF75C3N5YW...@reply.github.com, vim...@googlegroups.com
On 2021-06-14, zoumi wrote:
> Describe the bug
> I have set the tag file path with a absolute path, but gvim can't not find it.
>
> To Reproduce
> Detailed steps to reproduce the behavior:
>
> 1. create a tag file: C:\Users\zoumi.cache\HYtags
> 2. set tag file path for vim:
>
> :setl tags+=C:\Users\zoumi\.cache\HYtags,tags
>
> 3. check the file exist:
>
> echo filereadable('C:\Users\zoumi\.cache\HYtags')
>
> 4. check if vim can find this tag file
>
> echo tagfiles() "return 1
>
> Expected behavior
> echo tagfiles() should get ['C:\Users\zoumi.cache\HYtags'], but it return []
>
> Environment (please complete the following information):
>
> • Vim version
>
> VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun 13 2021 22:02:46)
> MS-Windows 64-bit GUI version with OLE support
> Included patches: 1-2994
> Compiled by appveyor@APPVYR-WIN
>
> • OS: Windows 10 64bit
> • Terminal: GUI

It works for me, on Windows 10 with the same Vim 8.2.2994.

From a Cygwin prompt:

$ touch 'C:\Users\gjohn\Documents\HYtags'

From a Windows Command Prompt:

C:\Program Files\Vim\vim82>gvim -N -u NONE -i NONE
:echo filereadable('C:\Users\gjohn\Documents\HYtags')
1
:setl tags+=C:\Users\gjohn\Documents\HYtags
:echo tagfiles()
['\Users\gjohn\Documents\HYtags']

I'm afraid I can't think of any reason it wouldn't work for you.

Regards,
Gary

vim-dev ML

unread,
Jun 14, 2021, 12:27:23 PM6/14/21
to vim/vim, vim-dev ML, Your activity

On 2021-06-14, zoumi wrote:
> Describe the bug
> I have set the tag file path with a absolute path, but gvim can't not find it.
>
> To Reproduce
> Detailed steps to reproduce the behavior:
>
> 1. create a tag file: C:\Users\zoumi.cache\HYtags
> 2. set tag file path for vim:

>
> :setl tags+=C:\Users\zoumi\.cache\HYtags,tags
>
> 3. check the file exist:

>
> echo filereadable('C:\Users\zoumi\.cache\HYtags')
>
> 4. check if vim can find this tag file

>
> echo tagfiles() "return 1
>
> Expected behavior
> echo tagfiles() should get ['C:\Users\zoumi.cache\HYtags'], but it return []
>
> Environment (please complete the following information):
>
> • Vim version
>
> VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jun 13 2021 22:02:46)
> MS-Windows 64-bit GUI version with OLE support
> Included patches: 1-2994
> Compiled by appveyor@APPVYR-WIN
>
> • OS: Windows 10 64bit
> • Terminal: GUI

It works for me, on Windows 10 with the same Vim 8.2.2994.

From a Cygwin prompt:

$ touch 'C:\Users\gjohn\Documents\HYtags'

From a Windows Command Prompt:

C:\Program Files\Vim\vim82>gvim -N -u NONE -i NONE
:echo filereadable('C:\Users\gjohn\Documents\HYtags')
1
:setl tags+=C:\Users\gjohn\Documents\HYtags
:echo tagfiles()
['\Users\gjohn\Documents\HYtags']

I'm afraid I can't think of any reason it wouldn't work for you.

Regards,
Gary

zoumi

unread,
Jun 14, 2021, 8:18:13 PM6/14/21
to vim/vim, vim-dev ML, Mention

@vim-ml I found it's because the dir name ".cache".If I change the name to "cache" it works.
I have set .gitignore to ignore all .* file, does this affects vim?


You are receiving this because you were mentioned.

zoumi

unread,
Jun 16, 2021, 8:15:02 AM6/16/21
to vim/vim, vim-dev ML, Mention

So,is it a bug?


You are receiving this because you were mentioned.

zoumi

unread,
Jun 19, 2021, 3:01:48 AM6/19/21
to vim/vim, vim-dev ML, Mention

It' because the plugin 'ZSaberLv0/ZFVimIgnore' set ".cache" in the wildignore option.


You are receiving this because you were mentioned.

zoumi

unread,
Jun 19, 2021, 3:01:49 AM6/19/21
to vim/vim, vim-dev ML, Mention

Closed #8380.


You are receiving this because you were mentioned.

Reply all
Reply to author
Forward
0 new messages