是否可以让vim在Windows上使用正斜杠?

时间:2013-08-27 11:23:51

标签: windows vim configuration path

Windows上的ViM本地构建在文件路径中使用反斜杠,包括完成,但如果我手动使用正斜杠(事实上所有Windows API都理解它们,cmd.exe是唯一的例外)并且反斜杠导致它工作正常各种各样的问题,因为它们可以作为逃避和" dwim"逻辑不起作用。例如:

:vimgrep /Foo/ src/*

工作正常,但

:vimgrep /Foo/ src\*

没有,因为\会转义*。手动我只是写正斜杠,但制表完成总是给我反斜杠,所以我必须一直改变它。

默认情况下是否可以重新配置ViM以使用正斜杠(最好不重新编译)?

1 个答案:

答案 0 :(得分:9)

这应该做你想要的事情

:set shellslash

帮助(: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')