diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2019-12-14 23:05:54 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2019-12-14 23:05:54 +0900 |
commit | dfbf5fa8977344772ed70a56ff2c84c091707ff0 (patch) | |
tree | 23bfb0ccdcd3b987e340c51f88de130553e7b743 /plugin | |
parent | a7f3d49b69adfdfa37586afbe2f9e4da960bfd2f (diff) | |
download | vim-lsp-settings-dfbf5fa8977344772ed70a56ff2c84c091707ff0.tar.gz vim-lsp-settings-dfbf5fa8977344772ed70a56ff2c84c091707ff0.tar.bz2 vim-lsp-settings-dfbf5fa8977344772ed70a56ff2c84c091707ff0.zip |
Suggestion
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/lsp_setup.vim | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/plugin/lsp_setup.vim b/plugin/lsp_setup.vim index dc5fe48..29ec87f 100644 --- a/plugin/lsp_setup.vim +++ b/plugin/lsp_setup.vim @@ -1,8 +1,23 @@ let s:setting_dir = expand('<sfile>:h:h').'/setting' +let s:installer_dir = expand('<sfile>:h:h').'/installer' let s:setting = json_decode(join(readfile(expand('<sfile>:h:h').'/setting.json'), "\n")) -function! s:vimlsp_settings_suggest(cmd) abort - echomsg "Do you install " . a:cmd +function! s:vimlsp_install_server() abort + if empty(s:setting[&filetype]) + return + endif + let l:command = printf('%s/install-%s', s:installer_dir, s:setting[&filetype][0].command) + if has('win32') + let l:command = substitute(l:command, '/', '\', 'g') . '.cmd' + else + let l:command = substitute(l:command, '/', '\', 'g') . '.sh' + endif + exe 'terminal' l:command +endfunction + +function! s:vimlsp_settings_suggest() abort + echomsg printf("If you want to enable Language Server, please do :LspInstallServer") + command -buffer LspInstallServer call s:vimlsp_install_server() endfunction function! s:vimlsp_setting() abort @@ -21,7 +36,7 @@ function! s:vimlsp_setting() abort if l:found == 0 exe printf('augroup vimlsp_suggest_%s', l:ft) au! - exe printf('autocmd FileType %s call s:vimlsp_settings_suggest(%s)', l:ft, string(s:setting[l:ft][0].command)) + exe printf('autocmd FileType %s call s:vimlsp_settings_suggest()', l:ft) augroup END endif endfor |