Is it possible to use vim for slash in windows?

The native ViM build on Windows uses a backslash in the file path, including for completion, although it works fine if I use direct slashes manually (in fact, all Windows APIs understand them, cmd.exe is the only exception). and backslashes cause various problems because they double as an escape, and the dwim logic doesn’t actually work. For instance:

 :vimgrep /Foo/ src/* 

works fine but

 :vimgrep /Foo/ src\* 

does not work because \ goes beyond * . In manual mode, I just write a slash, but ending the tab always gives me a backslash at the end, so I have to constantly change it.

Is it possible to reconfigure ViM to use the default slash (preferably without recompilation)?

+4
source share
1 answer

That should do what you want.

 :set shellslash 

Help ( :h shellslash ) copied below

  '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') 
+8
source

Source: https://habr.com/ru/post/1499118/


All Articles