Skip to content

Instantly share code, notes, and snippets.

@mattn
Created January 19, 2018 16:59
Show Gist options
  • Save mattn/49fb07afb77e821699e3642bc10db714 to your computer and use it in GitHub Desktop.
Save mattn/49fb07afb77e821699e3642bc10db714 to your computer and use it in GitHub Desktop.
vim-lsp の設定
if executable('typescript-language-server')
augroup LspTypeScript
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'],
\ })
autocmd FileType typescript setlocal omnifunc=lsp#complete
augroup END
endif
if executable('pyls')
" pip install python-language-server
augroup LspPython
au!
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'pyls',
\ 'cmd': {server_info->['pyls']},
\ 'whitelist': ['python'],
\ })
autocmd FileType python setlocal omnifunc=lsp#complete
augroup END
endif
if executable('go-langserver')
augroup LspGo
au!
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'go-lang',
\ 'cmd': {server_info->['go-langserver', '-mode', 'stdio', '-gocodecompletion']},
\ 'whitelist': ['go'],
\ })
autocmd FileType go setlocal omnifunc=lsp#complete
augroup END
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment