Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't open file with parentheses in path #1237

Closed
3 tasks done
sadguitarius opened this issue Sep 22, 2024 · 3 comments
Closed
3 tasks done

can't open file with parentheses in path #1237

sadguitarius opened this issue Sep 22, 2024 · 3 comments

Comments

@sadguitarius
Copy link

sadguitarius commented Sep 22, 2024

Contributing guidelines

Module(s)

mini.files

Description

I'm working through a Next.js tutorial and I found that when trying to access a file with parentheses in the path (a pattern used in Next.js) in mini.files, a blank buffer is shown. As far as I can tell, this may be the same as this and this. It's unclear to me if the issue was ever resolved in Neovim itself, but would this be something that could be dealt with on a case-by-case basis in mini.files?

Neovim version

0.10.1 (Windows)

Steps to reproduce

  1. create a file nested in a directory with the path name enclosed in parentheses
  2. try to open the file in mini.files

Expected behavior

A buffer should appear showing the contents of the file

Actual behavior

An empty buffer is shown

@sadguitarius sadguitarius added the bug Something isn't working label Sep 22, 2024
@echasnovski
Copy link
Owner

echasnovski commented Sep 22, 2024

Thanks for the issue!

Have you tried playing with 'isfname' as suggested here?

The 'mini.files' modules already tries to handle special characters in file names by using fnameescape(). Judging by its help:

For most systems the characters escaped are
" \t\n*?[{`$\\%#'\"|!<".  For systems where a backslash
appears in a filename, it depends on the value of 'isfname'.

And here is an excerpt from 'isfname' help:

Note that on systems using a backslash as path separator, Vim tries to
do its best to make it work as you would expect.  That is a bit
tricky, since Vi originally used the backslash to escape special
characters.  Vim will not remove a backslash in front of a normal file
name character on these systems, but it will on Unix and alikes.  The
'&' and '^' are not included by default, because these are special for
cmd.exe.

As I understand it, the issue is that paths like "aaa(bbb)\ccc.jsx" are treated as "aaa(bbb)cc.jsx" due to using backslash as path separator.

Could you try adding ( and ) to 'isfname' and see if this fixes things for you? It can be done via :set isfname+=(,) interactively or vim.opt.isfname:append({ '(', ')' }) in Lua.

@sadguitarius
Copy link
Author

Ha, that worked! I was having trouble figuring out how that solution would be implemented. Thanks!

@echasnovski
Copy link
Owner

Thanks for confirming! I don't have reliable access to Windows machine, so having this information is very useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants