aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2019-12-14 23:08:32 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2019-12-14 23:08:32 +0900
commitd9a3d14fe93f9445dc9471c0dc5b78c8bdd8f17a (patch)
tree18cccdb03009910da22277b069ec23ce7560ed63 /plugin
parentdfbf5fa8977344772ed70a56ff2c84c091707ff0 (diff)
downloadvim-lsp-settings-d9a3d14fe93f9445dc9471c0dc5b78c8bdd8f17a.tar.gz
vim-lsp-settings-d9a3d14fe93f9445dc9471c0dc5b78c8bdd8f17a.tar.bz2
vim-lsp-settings-d9a3d14fe93f9445dc9471c0dc5b78c8bdd8f17a.zip
Install
Diffstat (limited to 'plugin')
-rw-r--r--plugin/lsp_setup.vim15
1 files changed, 13 insertions, 2 deletions
diff --git a/plugin/lsp_setup.vim b/plugin/lsp_setup.vim
index 29ec87f..0349741 100644
--- a/plugin/lsp_setup.vim
+++ b/plugin/lsp_setup.vim
@@ -2,9 +2,9 @@ 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_install_server() abort
+function! s:vimlsp_installer()
if empty(s:setting[&filetype])
- return
+ return ''
endif
let l:command = printf('%s/install-%s', s:installer_dir, s:setting[&filetype][0].command)
if has('win32')
@@ -12,10 +12,21 @@ function! s:vimlsp_install_server() abort
else
let l:command = substitute(l:command, '/', '\', 'g') . '.sh'
endif
+ if !executable(l:command)
+ return ''
+ endif
+ return l:command
+endfunction
+
+function! s:vimlsp_install_server() abort
+ let l:command = s:vimlsp_installer()
exe 'terminal' l:command
endfunction
function! s:vimlsp_settings_suggest() abort
+ if empty(s:vimlsp_installer())
+ return
+ endif
echomsg printf("If you want to enable Language Server, please do :LspInstallServer")
command -buffer LspInstallServer call s:vimlsp_install_server()
endfunction