summaryrefslogtreecommitdiff
path: root/autoload/ale/path.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/path.vim')
-rw-r--r--autoload/ale/path.vim11
1 files changed, 9 insertions, 2 deletions
diff --git a/autoload/ale/path.vim b/autoload/ale/path.vim
index 60d42eb5..84c26d0a 100644
--- a/autoload/ale/path.vim
+++ b/autoload/ale/path.vim
@@ -3,13 +3,20 @@
" simplify a path, and fix annoying issues with paths on Windows.
"
-" Forward slashes are changed to back slashes so path equality works better.
+" Forward slashes are changed to back slashes so path equality works better
+" on Windows. Back slashes are changed to forward slashes on Unix.
+"
+" Unix paths can technically contain back slashes, but in practice no path
+" should, and replacing back slashes with forward slashes makes linters work
+" in environments like MSYS.
"
" Paths starting with more than one forward slash are changed to only one
" forward slash, to prevent the paths being treated as special MSYS paths.
function! ale#path#Simplify(path) abort
if has('unix')
- return substitute(simplify(a:path), '^//\+', '/', 'g') " no-custom-checks
+ let l:unix_path = substitute(a:path, '\\', '/', 'g')
+
+ return substitute(simplify(l:unix_path), '^//\+', '/', 'g') " no-custom-checks
endif
let l:win_path = substitute(a:path, '/', '\\', 'g')