wsdjeg / vim-fetch

Make Vim handle line and column numbers in file names with a minimum of fuss
http://www.vim.org/scripts/script.php?script_id=5089
MIT License
312 stars 17 forks source link

escape filename since backslash make problems on Windows #21

Closed mattn closed 4 years ago

mattn commented 6 years ago

Using vim-fetch on Windows, and open a file with vim ~/_vimrc:20. If you use noshellslash (default), the filename will be handled as ~\_vimrc:20. So this backslash break vim-fetch.

wsdjeg commented 6 years ago

@mattn Does it help with filename with space in it? for example ~/_\ foo/foo.vim?

mattn commented 6 years ago

Now I can open a file contains backslash and spaces.

mattn commented 6 years ago

Well, I'm sending this PR since I got the problem you mentioned.

mattn commented 6 years ago

When BufNewFile is triggerd, the code do execute command. the literal string must be escaped.

kopischke commented 6 years ago

Well, I'm sending this PR since I got the problem you mentioned.

Of course, and my bad for being unprecise in my review. Please see below the next quote for a more detailed reply.

When BufNewFile is triggerd, the code do execute command. the literal string must be escaped.

I understand that much, and I’m very glad you caught this. However, the event you modify only covers vim file:num calls, with or without -o or -O. What I am wondering about is the VimEnter event on line 29+ (that is what makes :e file:num work once Vim has loaded), which also uses execute, and the TabEnter event (that is what makes vim -p file1 file2:num work), which does not.

mattn commented 6 years ago

Ah, make sense. I'll look into it in later. :)