diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2019-12-16 03:03:56 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2019-12-16 03:03:56 +0900 |
commit | b5e7b1bae71e873c06691aa73ddddba7cf38a2db (patch) | |
tree | 08bc3bc3dace3c13d4468dff88dafbfd61acc832 /autoload/lsp_settings.vim | |
parent | a4896a9adb97a0d119e80119dd99f1d9130ce5f9 (diff) | |
download | vim-lsp-settings-b5e7b1bae71e873c06691aa73ddddba7cf38a2db.tar.gz vim-lsp-settings-b5e7b1bae71e873c06691aa73ddddba7cf38a2db.tar.bz2 vim-lsp-settings-b5e7b1bae71e873c06691aa73ddddba7cf38a2db.zip |
Use first one
Diffstat (limited to 'autoload/lsp_settings.vim')
-rw-r--r-- | autoload/lsp_settings.vim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index a9cead0..3514b3f 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -16,6 +16,13 @@ function! lsp_settings#get(name, key, default) abort return l:config[a:key] endfunction +function! s:first_one(cmd) abort + if empty(a:cmd) + return '' + endif + return fnamemodify(split(a:cmd, "\n")[0], ':p') +endfunction + function! lsp_settings#exec_path(cmd) abort if executable(a:cmd) return a:cmd @@ -26,7 +33,7 @@ function! lsp_settings#exec_path(cmd) abort endif let l:paths .= ',' . s:servers_dir . '/' . a:cmd if !has('win32') - return globpath(l:paths, a:cmd) + return s:first_one(globpath(l:paths, a:cmd)) endif let l:path = globpath(l:paths, a:cmd . '.exe') if !empty(l:path) |