@@ -59,7 +59,7 @@ function M.posix_to_windows(posix_path)
5959
6060
6161 -- For edgy-ephemeral cases when vim.fn.expand() eats posix-style path.
62- -- In that case we get forward slashes everywhere which we don't need
62+ -- In that case we get backslashes everywhere which we don't need
6363 -- when working with libuv which uses WinAPI under the hood.
6464 -- E.g. vim.fn.expand("/home/User") gives "\home\User".
6565 posix_path = posix_path :gsub (" \\ " , " /" )
@@ -92,26 +92,27 @@ function M.posix_to_windows(posix_path)
9292 -- Idk if WezTerm paths behaviour leaks to msys2 actually...
9393 if not prefix_changed then
9494 if # posix_path == 2 and posix_path :find (" /[A-Za-z]" ) then
95- -- vim.notify("Only '[A-Za-z]: ' case: " .. posix_path, vim.log.levels.WARN)
95+ -- vim.notify("Only '/ [A-Za-z]' case: " .. posix_path, vim.log.levels.WARN)
9696 posix_path = posix_path :gsub (" ^/([A-Za-z])" , " %1:\\ " )
9797 prefix_changed = true
9898 else
99- -- vim.notify("'[A-Za-z]:?/' case: " .. posix_path, vim.log.levels.WARN)
99+ -- vim.notify("'/ [A-Za-z]:?/' case: " .. posix_path, vim.log.levels.WARN)
100100 posix_path = posix_path :gsub (" ^/([A-Za-z]):?/" , " %1:\\ " )
101101 prefix_changed = true
102102 end
103103 end
104104
105- -- Lets try to be msys2 compliant for testing.
105+ -- Lets try to use posix-style paths for testing.
106106 -- posix_path = posix_path:gsub("^/([A-Za-z]):?([^0-9A-Za-z_-]?)", "/%1%2")
107107
108108
109109 -- Replace remaining forward slashes with backslashes.
110110 posix_path = posix_path :gsub (" /" , " \\ " )
111111
112- -- For bash.exe (nvim shell) it is better to use backslashes
113- -- cause forward slashes must be escaped. Need to come up with something
114- -- cause nvim for windows (even clang64 binary) prefers windows-style paths (with backslashes?).
112+ -- For bash.exe (nvim shell) it is better to use forward slashes
113+ -- cause backslashes must to be escaped. Need to come up with something
114+ -- cause nvim for windows (even clang64 binary) prefers windows-style paths (but works with forward slashes as well?).
115+ -- UPD. "set shellslash" makes the trick by converting backslashes to forward slashes in shell invocations.
115116 -- posix_path = posix_path:gsub("\\", "/")
116117
117118
0 commit comments