diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2019-12-15 22:10:27 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2019-12-15 22:10:27 +0900 |
commit | 799457522c9aee6b126d95eb2fbc1a66286f664e (patch) | |
tree | eda8dc1aadcc8126ffc939682728ac426e181a07 /autoload | |
parent | d93ca7e89884bc5f8656a60460e5f743810a2cb3 (diff) | |
download | vim-lsp-settings-799457522c9aee6b126d95eb2fbc1a66286f664e.tar.gz vim-lsp-settings-799457522c9aee6b126d95eb2fbc1a66286f664e.tar.bz2 vim-lsp-settings-799457522c9aee6b126d95eb2fbc1a66286f664e.zip |
Add lsp_settings_extra_paths
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/lsp_settings.vim | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index e3ce81b..4d66b7f 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -1,11 +1,39 @@ function! lsp_settings#get(name, key, default) abort - let l:config = get(g:, 'lsp_settings', {}) + let l:config = get(g:, 'lsp_settings_extra_paths', {}) if !has_key(l:config, a:name) - return a:default + if !has_key(l:config, '*') + return a:default + endif + let l:config = l:config['*'] + else + let l:config = l:config[a:name] endif - let l:config = l:config[a:name] if !has_key(l:config, a:key) return a:default endif return l:config[a:key] endfunction + +function! lsp_settings#exec_path(cmd) abort + if executable(a:cmd) + return a:cmd + endif + let l:paths = get(g:, 'lsp_settings_paths', '') + if !has('win32') + return !empty(globpath(l:paths, a:cmd)) + endif + let l:path = globpath(l:paths, a:cmd . '.exe') + if !empty(l:path) + return l:path + endif + let l:path = globpath(l:paths, a:cmd . '.cmd') + if !empty(l:path) + return l:path + endif + let l:path = globpath(l:paths, a:cmd . '.bat') + if !empty(l:path) + return l:path + endif + return '' +endfunction + |