attempt to use gopls only
This commit is contained in:
parent
f763d7b994
commit
095b5798f2
3 changed files with 47 additions and 26 deletions
|
|
@ -93,8 +93,8 @@ augroup go
|
||||||
autocmd FileType go set softtabstop=2
|
autocmd FileType go set softtabstop=2
|
||||||
autocmd FileType go set shiftwidth=2
|
autocmd FileType go set shiftwidth=2
|
||||||
autocmd FileType go set noexpandtab
|
autocmd FileType go set noexpandtab
|
||||||
autocmd FileType go nmap <Leader>gd <Plug>(go-doc)
|
"autocmd FileType go nmap <Leader>gd <Plug>(go-doc)
|
||||||
autocmd FileType go nmap gd <Plug>(go-def)
|
"autocmd FileType go nmap gd <Plug>(go-def)
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup idris
|
augroup idris
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,24 @@ nvim_lsp.gopls.setup({ on_attach=on_attach })
|
||||||
nvim_lsp.pyright.setup({ on_attach=on_attach })
|
nvim_lsp.pyright.setup({ on_attach=on_attach })
|
||||||
nvim_lsp.clangd.setup({ on_attach=on_attach })
|
nvim_lsp.clangd.setup({ on_attach=on_attach })
|
||||||
|
|
||||||
|
function org_imports(wait_ms)
|
||||||
|
local params = vim.lsp.util.make_range_params()
|
||||||
|
|
||||||
|
params.context = {only = {"source.organizeImports"}}
|
||||||
|
|
||||||
|
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, wait_ms)
|
||||||
|
|
||||||
|
for _, res in pairs(result or {}) do
|
||||||
|
for _, r in pairs(res.result or {}) do
|
||||||
|
if r.edit then
|
||||||
|
vim.lsp.util.apply_workspace_edit(r.edit)
|
||||||
|
else
|
||||||
|
vim.lsp.buf.execute_command(r.command)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
nvim_lsp.efm.setup {
|
nvim_lsp.efm.setup {
|
||||||
init_options = {documentFormatting = true},
|
init_options = {documentFormatting = true},
|
||||||
settings = {
|
settings = {
|
||||||
|
|
@ -115,7 +133,8 @@ vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
|
||||||
require('lspkind').init({
|
require('lspkind').init({
|
||||||
-- disables text annotations
|
-- disables text annotations
|
||||||
with_text = false,
|
--with_text = false,
|
||||||
|
with_text = true,
|
||||||
|
|
||||||
-- default symbol map
|
-- default symbol map
|
||||||
-- can be either 'default' or 'codicons'
|
-- can be either 'default' or 'codicons'
|
||||||
|
|
@ -123,28 +142,28 @@ require('lspkind').init({
|
||||||
|
|
||||||
-- override preset symbols
|
-- override preset symbols
|
||||||
-- default: {}
|
-- default: {}
|
||||||
symbol_map = {
|
--symbol_map = {
|
||||||
Method = 'm',
|
--Method = 'm',
|
||||||
Function = 'f',
|
--Function = 'f',
|
||||||
Text = 'txt',
|
--Text = 'txt',
|
||||||
Constructor = 'new',
|
--Constructor = 'new',
|
||||||
Variable = 'var',
|
--Variable = 'var',
|
||||||
Class = 'cls',
|
--Class = 'cls',
|
||||||
Interface = 'iface',
|
--Interface = 'iface',
|
||||||
Module = 'mod',
|
--Module = 'mod',
|
||||||
Property = 'prop',
|
--Property = 'prop',
|
||||||
Unit = 'unit',
|
--Unit = 'unit',
|
||||||
Value = 'val',
|
--Value = 'val',
|
||||||
Enum = 'enum',
|
--Enum = 'enum',
|
||||||
Keyword = 'kw',
|
--Keyword = 'kw',
|
||||||
Snippet = 'sn',
|
--Snippet = 'sn',
|
||||||
Color = 'color',
|
--Color = 'color',
|
||||||
File = 'file',
|
--File = 'file',
|
||||||
Folder = 'fold',
|
--Folder = 'fold',
|
||||||
EnumMember = 'enum',
|
--EnumMember = 'enum',
|
||||||
Constant = 'const',
|
--Constant = 'const',
|
||||||
Struct = 'struct',
|
--Struct = 'struct',
|
||||||
},
|
--},
|
||||||
})
|
})
|
||||||
|
|
||||||
require('trouble').setup {
|
require('trouble').setup {
|
||||||
|
|
|
||||||
4
.vimrc
4
.vimrc
|
|
@ -142,7 +142,7 @@ Plug 'airblade/vim-rooter'
|
||||||
Plug 'majutsushi/tagbar'
|
Plug 'majutsushi/tagbar'
|
||||||
Plug 'SirVer/ultisnips'
|
Plug 'SirVer/ultisnips'
|
||||||
Plug 'honza/vim-snippets'
|
Plug 'honza/vim-snippets'
|
||||||
Plug 'fatih/vim-go'
|
"Plug 'fatih/vim-go'
|
||||||
Plug 'jiangmiao/auto-pairs'
|
Plug 'jiangmiao/auto-pairs'
|
||||||
Plug 'tpope/vim-abolish'
|
Plug 'tpope/vim-abolish'
|
||||||
Plug 'sheerun/vim-polyglot'
|
Plug 'sheerun/vim-polyglot'
|
||||||
|
|
@ -317,6 +317,8 @@ autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics({show_header =
|
||||||
autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 1000)
|
autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||||
autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 1000)
|
autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||||
autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
|
autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
|
||||||
|
autocmd BufWritePre *.go lua vim.lsp.buf.formatting_seq_sync(nil, 1000)
|
||||||
|
autocmd BufWritePre *.go :silent! lua org_imports(3000)
|
||||||
|
|
||||||
" Goto previous/next diagnostic warning/error
|
" Goto previous/next diagnostic warning/error
|
||||||
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
|
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue