Jan*_*dec 6 windows vim configuration path
Windows上的ViM本地构建在文件路径中使用反斜杠,包括完成,但如果我手动使用正斜杠(事实上所有Windows API都理解它们,cmd.exe是唯一的例外)它可以正常工作,并且反斜杠会导致各种问题,因为它们会成为转义的两倍并且"dwim"逻辑并不真正起作用.例如:
:vimgrep /Foo/ src/*
Run Code Online (Sandbox Code Playgroud)
工作得很好,但是
:vimgrep /Foo/ src\*
Run Code Online (Sandbox Code Playgroud)
没有,因为\逃脱了*.手动我只是写正斜杠,但制表完成总是给我反斜杠,所以我必须一直改变它.
是否可以在默认情况下重新配置ViM以使用正斜杠(最好不重新编译)?
这应该做你想要的
:set shellslash
Run Code Online (Sandbox Code Playgroud)
帮助(:h shellslash)复制如下
'shellslash' 'ssl' 'noshellslash' 'nossl'
'shellslash' 'ssl' boolean (default off)
global
{not in Vi} {only for MSDOS, MS-Windows and OS/2}
When set, a forward slash is used when expanding file names. This is
useful when a Unix-like shell is used instead of command.com or
cmd.exe. Backward slashes can still be typed, but they are changed to
forward slashes by Vim.
Note that setting or resetting this option has no effect for some
existing file names, thus this option needs to be set before opening
any file for best results. This might change in the future.
'shellslash' only works when a backslash can be used as a path
separator. To test if this is so use:
if exists('+shellslash')
Run Code Online (Sandbox Code Playgroud)