diff options
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | installer/install-gopls.cmd | 3 | ||||
-rw-r--r-- | installer/install-gopls.sh | 4 | ||||
-rw-r--r-- | plugin/lsp_setup.vim | 14 | ||||
-rw-r--r-- | setting.json | 72 | ||||
-rw-r--r-- | setting/clangd.vim | 8 | ||||
-rw-r--r-- | setting/gopls.vim | 9 | ||||
-rw-r--r-- | setting/intelephense-server.vim | 8 | ||||
-rw-r--r-- | setting/pyls.vim | 8 | ||||
-rw-r--r-- | setting/rls.vim | 8 | ||||
-rw-r--r-- | setting/solargraph.vim | 9 | ||||
-rw-r--r-- | setting/typescript-language-server.vim | 9 |
12 files changed, 163 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..a55b595 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# vim-lsp-settings + +NOTE: This is very experimental project. + +## License + +MIT + +## Author + +Yasuhiro Matsumoto (a.k.a. mattn) diff --git a/installer/install-gopls.cmd b/installer/install-gopls.cmd new file mode 100644 index 0000000..5bdfa9a --- /dev/null +++ b/installer/install-gopls.cmd @@ -0,0 +1,3 @@ +@echo off + +go get -u golang.org/x/tools/cmd/gopls diff --git a/installer/install-gopls.sh b/installer/install-gopls.sh new file mode 100644 index 0000000..3327911 --- /dev/null +++ b/installer/install-gopls.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +go get -u golang.org/x/tools/cmd/gopls + diff --git a/plugin/lsp_setup.vim b/plugin/lsp_setup.vim new file mode 100644 index 0000000..8c22b00 --- /dev/null +++ b/plugin/lsp_setup.vim @@ -0,0 +1,14 @@ +let s:setting_dir = expand('<sfile>:h:h').'/setting' +let s:setting = json_decode(join(readfile(expand('<sfile>:h:h').'/setting.json'), "\n")) + +function! s:vimlsp_setting() abort + for l:ft in keys(s:setting) + for l:command in keys(s:setting[l:ft]) + if executable(l:command) + exe 'source' printf('%s/%s.vim', s:setting_dir, l:command) + endif + endfor + endfor +endfunction + +call s:vimlsp_setting() diff --git a/setting.json b/setting.json new file mode 100644 index 0000000..081cf05 --- /dev/null +++ b/setting.json @@ -0,0 +1,72 @@ +{ + "typescript": { + "typescript-language-server": { + "requires": [ + "npm" + ] + } + }, + "javascript": { + "javascript-typescript-langserver": { + "requires": [ + "npm" + ] + }, + "typescript-language-server": { + "requires": [ + "npm" + ] + } + }, + "python": { + "pyls": { + "requires": [ + "pip" + ] + } + }, + "rust": { + "rls": { + "requires": [ + "rustup" + ] + } + }, + "go": { + "gopls": { + "requires": [ + "go" + ] + } + }, + "ruby": { + "solargraph": { + "requires": [ + "gem" + ] + } + }, + "php": { + "intelephense-server": { + "requires": [ + "npm" + ] + } + }, + "java": { + "eclipse-jdt-ls": {} + }, + "kotlin": { + "kotlin-language-server": {} + }, + "lua": { + "emmylua-ls": {} + }, + "vim": { + "vim-language-server": { + "requires": [ + "npm" + ] + } + } +} diff --git a/setting/clangd.vim b/setting/clangd.vim new file mode 100644 index 0000000..1d93f02 --- /dev/null +++ b/setting/clangd.vim @@ -0,0 +1,8 @@ +augroup vimlsp_settings_clangd + au! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'clangd', + \ 'cmd': {server_info->['clangd']}, + \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'], + \ }) +augroup END diff --git a/setting/gopls.vim b/setting/gopls.vim new file mode 100644 index 0000000..d31d4c9 --- /dev/null +++ b/setting/gopls.vim @@ -0,0 +1,9 @@ +augroup vimlsp_settings_gopls + au! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'gopls', + \ 'cmd': {server_info->['gopls']}, + \ 'initialization_options': {"diagnostics": "false"}, + \ 'whitelist': ['go'], + \ }) +augroup END diff --git a/setting/intelephense-server.vim b/setting/intelephense-server.vim new file mode 100644 index 0000000..9d70241 --- /dev/null +++ b/setting/intelephense-server.vim @@ -0,0 +1,8 @@ +augroup vimlsp_settings_intelephense_server + au! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'intelephense', + \ 'cmd': {server_info->[&shell, &shellcmdflag, 'intelephense-server --stdio']}, + \ 'whitelist': ['php'], + \ }) +augroup END diff --git a/setting/pyls.vim b/setting/pyls.vim new file mode 100644 index 0000000..381f494 --- /dev/null +++ b/setting/pyls.vim @@ -0,0 +1,8 @@ +augroup vimlsp_settings_pyls + au! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'pyls', + \ 'cmd': {server_info->['pyls']}, + \ 'whitelist': ['python'], + \ }) +augroup END diff --git a/setting/rls.vim b/setting/rls.vim new file mode 100644 index 0000000..65b38ef --- /dev/null +++ b/setting/rls.vim @@ -0,0 +1,8 @@ +augroup vimlsp_settings_rls + au! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'rls', + \ 'cmd': {server_info->['rls']}, + \ 'whitelist': ['rust'], + \ }) +augroup END diff --git a/setting/solargraph.vim b/setting/solargraph.vim new file mode 100644 index 0000000..169c847 --- /dev/null +++ b/setting/solargraph.vim @@ -0,0 +1,9 @@ +augroup vimlsp_settings_solargraph + au! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'solargraph', + \ 'cmd': {server_info->[&shell, &shellcmdflag, 'solargraph stdio']}, + \ 'initialization_options': {"diagnostics": "true"}, + \ 'whitelist': ['ruby'], + \ }) +augroup END diff --git a/setting/typescript-language-server.vim b/setting/typescript-language-server.vim new file mode 100644 index 0000000..1cd1f5c --- /dev/null +++ b/setting/typescript-language-server.vim @@ -0,0 +1,9 @@ +augroup vimlsp_settings_typescript_language_server + au! + autocmd User lsp_setup call lsp#register_server({ + \ 'name': 'typescript-language-server', + \ 'cmd': {server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']}, + \ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'tsconfig.json'))}, + \ 'whitelist': ['typescript'], + \ }) +augroup END |