nmap <buffer> gs <plug>(lsp-document-symbol-search)
nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
nmap <buffer> gr <plug>(lsp-references)
nmap <buffer> gi <plug>(lsp-implementation)
nmap <buffer> gt <plug>(lsp-type-definition)
nmap <buffer><leader>rn <plug>(lsp-rename)
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
nmap <buffer> K " nnoremap <buffer><expr><c-f> lsp#scroll(+4) " nnoremap let g:lsp_format_sync_timeout = 1000 autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync') " refer to doc to add more commands endfunction augroup lsp_install au! " call s:on_lsp_buffer_enabled only for languages that has the server registered. autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() augroup END " for ultisnips let g:UltiSnipsExpandTrigger="<tab>" let g:UltiSnipsJumpForwardTrigger="<tab>" let g:UltiSnipsJumpBackwardTrigger="<s-tab>" set completeopt+=menuone 最后,我们就需要安装Zig语言的LSP插件zls了。先用homebrew安装zls,命令是brew install zls。然后将目录切换到随便一个Zig项目,用vim打开一个后缀为.zig的Zig源代码文件。然后用命令:LspInstallServer在vim中安装和配置zls插件。因为Zig现在有一个bug,通过代理下载文件会出错,所以这个插件安装过程会出错,但是可以不用管它。这个安装zls的命令执行完成后,退出vim,执行如下命令将zls.json的配置复制到zls的缺省配置目录下: cp ~/.local/share/vim-lsp-settings/servers/zls/zls.json ~/Library/Application\ Support/ 这个zls的缺省配置目录可以使用命令zls --show-config-path来得到。 数学联邦政治世界观提示您:看后求收藏(同人小说网http://tongren.me),接着再看更方便。