aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrabir <mail@prabir.me>2020-01-05 17:36:04 -0800
committerPrabir <mail@prabir.me>2020-01-05 17:36:04 -0800
commit1d5dbefdf6fcbe1e90431ccb634827bb347cc3dd (patch)
treea8c9e05b15aaec6cccaf18e08ce5e124aaa4ff56
parent6d949ce6ce9ed6a0feb1024edada76bd411498b3 (diff)
downloadvim-lsp-settings-1d5dbefdf6fcbe1e90431ccb634827bb347cc3dd.tar.gz
vim-lsp-settings-1d5dbefdf6fcbe1e90431ccb634827bb347cc3dd.tar.bz2
vim-lsp-settings-1d5dbefdf6fcbe1e90431ccb634827bb347cc3dd.zip
fix globpath so it removes trailing slash if it exists
-rw-r--r--autoload/lsp_settings.vim15
1 files changed, 13 insertions, 2 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim
index d59d4ed..d6ecd5e 100644
--- a/autoload/lsp_settings.vim
+++ b/autoload/lsp_settings.vim
@@ -28,8 +28,19 @@ function! lsp_settings#exec_path(cmd) abort
let l:dir = len(l:s) >= 1 ? l:s[0] : ''
let l:cmd = len(l:s) >= 2 ? l:s[1] : l:s[0]
- let l:paths = split($PATH, has('win32') ? ';' : ':')
- let l:paths = join(l:paths, ',')
+ let l:paths = []
+ if has('win32')
+ for l:path in split($PATH, ';')
+ if l:path[len(l:path) - 1:] == "\\"
+ call add(l:paths, l:path[:len(l:path)-2])
+ elseif !empty(l:path)
+ call add(l:paths, l:path)
+ endif
+ endfor
+ else
+ let l:path = split($PATH, ':')
+ endif
+ let l:paths = join(l:paths, ",")
let l:path = globpath(l:paths, l:cmd)
if !has('win32')
if !empty(l:path)