aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-21 18:44:28 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2020-01-21 18:44:28 +0900
commitf9125915d500ab381f0b14d451908493064867de (patch)
treed631c695c2702c08066c234fd785594aea0abb2e /plugin
parent3f2a222c14aed65d588a1770991f47ab5aa651eb (diff)
downloadvim-lsp-settings-f9125915d500ab381f0b14d451908493064867de.tar.gz
vim-lsp-settings-f9125915d500ab381f0b14d451908493064867de.tar.bz2
vim-lsp-settings-f9125915d500ab381f0b14d451908493064867de.zip
Suggest vim plugin
Diffstat (limited to 'plugin')
-rw-r--r--plugin/lsp_settings.vim28
1 files changed, 27 insertions, 1 deletions
diff --git a/plugin/lsp_settings.vim b/plugin/lsp_settings.vim
index c90b039..cf368be 100644
--- a/plugin/lsp_settings.vim
+++ b/plugin/lsp_settings.vim
@@ -123,7 +123,7 @@ function! s:vimlsp_settings_suggest() abort
if exists(':LspInstallServer') !=# 2
redraw
echohl Directory
- echomsg 'If you want to enable Language Server, please do :LspInstallServer'
+ echomsg 'If enable Language Server, please do :LspInstallServer'
echohl None
command! -buffer LspInstallServer call s:vimlsp_install_server()
endif
@@ -155,6 +155,32 @@ function! s:vimlsp_setting() abort
exe 'autocmd FileType' l:ft 'call s:vimlsp_load_or_suggest(' string(l:ft) ')'
augroup END
endfor
+ augroup vimlsp_suggest
+ au!
+ autocmd BufNewFile,BufRead * call s:vimlsp_suggest_plugin()
+ augroup END
+endfunction
+
+function! s:vimlsp_suggest_plugin() abort
+ if &ft != ''
+ return
+ endif
+ let l:ext = expand('%:e')
+ for l:ft in keys(s:settings)
+ for l:server in s:settings[l:ft]
+ if !has_key(l:server, 'vim-plugin')
+ continue
+ endif
+ if index(l:server['vim-plugin']['extensions'], l:ext) == -1
+ continue
+ endif
+ redraw
+ echohl Directory
+ echomsg printf('If enable Language Server, please install vim-plugin "%s"', l:server['vim-plugin']['name'])
+ echohl None
+ return
+ endfor
+ endfor
endfunction
function! s:vimlsp_load_or_suggest(ft) abort