While trying out the new fnameescape() function in VIM 7.2 on Windows, I noticed
that there's a mismatch between what is escaped and what is accepted by commands
like :edit when the filename contains a '!' character. The ex commands cannot
deal with the escaped '\!' and treat the backslash as a path separator:
vim -N -u NONE
:echo fnameescape('foo!bar.txt')
foo\!bar.txt
:e foo\!bar.txt
"foo\!bar.txt" [New DIRECTORY]
Likewise, the file completion in command-line mode now also escapes the !
character, and a completed :edit command is unable to open the existing file:
cmd /c
echo testfile > foo#bar!baz.txt
"%ProgramFiles%\Vim\vim72\vim" -N -u NONE
:e foo<Tab> " expansion results in:
:e foo\#bar\!baz.txt
"foo#bar\!baz.txt" [New DIRECTORY]
This is a regression from VIM 7.1, which did not escape the '!':
cmd /c
echo testfile > foo#bar!baz.txt
"%ProgramFiles%\Vim\vim71\vim" -N -u NONE
:e foo<Tab> " expansion results in:
:e foo\#bar!baz.txt
"foo#bar!baz.txt" 1L, 11C
This occurs on Windows XP, but not on Linux (there, the ex commands accept the
escaped \!). I've tried both the default VIM - Vi IMproved 7.2 (2008 Aug 9,
compiled Aug 9 2008 18:46:22), GUI and console versions, as well as a fairly
recent VIM 7.2.77 build from the Cream project.
-- best regards, ingo
--
-- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --
--
Opinions are like assholes -- everyone's got one, but nobody wants to
look at the other guy's. -- Hal Hickman