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

标签 windows vim configuration path

Windows 上 ViM 的本地构建在文件路径中使用反斜杠,包括完成,尽管如果我手动使用正斜杠它工作正常(事实上所有 Windows API 都理解它们,cmd.exe 是唯一的exception) 和反斜杠会导致各种问题,因为它们兼作转义并且“dwim”逻辑实际上不起作用。例如:

:vimgrep /Foo/ src/*

工作得很好,但是

:vimgrep /Foo/ src\*

不会,因为 \ 转义了 *。手动我只写正斜杠,但制表符完成总是在最后给我反斜杠,所以我必须一直更改它。

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

最佳答案

这应该做你想做的

: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')

关于windows - 是否可以让 vim 在 Windows 上使用正斜杠?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18464038/

相关文章:

ruby-on-rails - 使用 Windows 安装 json 1.8.2 时出错

bash - 就地在文件中将时间戳转换为纪元

vim - vim中如何反复搜索&替换一长串文本?

eclipse - 如何更改 Eclipse 窗口标题?

windows - "For"和 "usebackq"不使用反引号

windows - 在 Windows Server 上部署的最佳免费 Web 框架?

python - 为什么这个 pyd 文件在某些​​计算机上无法导入?

regex - 如何在 vim 中使用正则表达式打开编译后的 pdf

eclipse - 为什么 "Build configurations..."在带有 QT eclipse 插件的 Eclipse CDT 中不可用?

hadoop - 如何禁用 hadoop 组合器?