vim: add more lsp config
This commit is contained in:
parent
384601bc66
commit
f506b8ee51
53
vimrc
53
vimrc
@ -150,6 +150,8 @@ se inccommand=nosplit
|
|||||||
set mouse=
|
set mouse=
|
||||||
set title
|
set title
|
||||||
|
|
||||||
|
let mapleader=" "
|
||||||
|
|
||||||
let g:jellybeans_overrides = {
|
let g:jellybeans_overrides = {
|
||||||
\ 'background': { 'guibg': '000000' },
|
\ 'background': { 'guibg': '000000' },
|
||||||
\ 'Normal': { 'guifg': 'ffffff' },
|
\ 'Normal': { 'guifg': 'ffffff' },
|
||||||
@ -214,9 +216,6 @@ lua <<EOF
|
|||||||
-- setup" for easy enabling of the above.
|
-- setup" for easy enabling of the above.
|
||||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', {noremap = true})
|
|
||||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', {noremap = true})
|
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
vim.api.nvim_exec([[
|
vim.api.nvim_exec([[
|
||||||
augroup lsp_document_highlight
|
augroup lsp_document_highlight
|
||||||
autocmd!
|
autocmd!
|
||||||
@ -260,6 +259,29 @@ lua <<EOF
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require'compe'.setup {
|
||||||
|
enabled = true;
|
||||||
|
autocomplete = true;
|
||||||
|
debug = false;
|
||||||
|
min_length = 1;
|
||||||
|
preselect = 'enable';
|
||||||
|
throttle_time = 80;
|
||||||
|
source_timeout = 200;
|
||||||
|
incomplete_delay = 400;
|
||||||
|
max_abbr_width = 100;
|
||||||
|
max_kind_width = 100;
|
||||||
|
max_menu_width = 100;
|
||||||
|
documentation = true;
|
||||||
|
|
||||||
|
source = {
|
||||||
|
path = true;
|
||||||
|
buffer = true;
|
||||||
|
calc = true;
|
||||||
|
nvim_lsp = true;
|
||||||
|
nvim_lua = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
||||||
@ -269,6 +291,31 @@ hi LspDiagnosticsDefaultError cterm=bold ctermfg=Red
|
|||||||
hi LspDiagnosticsDefaultWarning cterm=bold ctermfg=Yellow
|
hi LspDiagnosticsDefaultWarning cterm=bold ctermfg=Yellow
|
||||||
hi LspDiagnosticsDefaultInformation ctermfg=Blue
|
hi LspDiagnosticsDefaultInformation ctermfg=Blue
|
||||||
|
|
||||||
|
inoremap <silent><expr> <C-Space> compe#complete()
|
||||||
|
inoremap <silent><expr> <CR> compe#confirm('<CR>')
|
||||||
|
inoremap <silent><expr> <C-e> compe#close('<C-e>')
|
||||||
|
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
|
||||||
|
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
|
||||||
|
|
||||||
|
nnoremap gD <Cmd>lua vim.lsp.buf.declaration()<CR>
|
||||||
|
nnoremap gd <Cmd>lua vim.lsp.buf.definition()<CR>
|
||||||
|
nnoremap K <Cmd>lua vim.lsp.buf.hover()<CR>
|
||||||
|
nnoremap <leader>K <cmd>lua vim.lsp.diagnostic.show_line_diagnostics{show_header = false}<CR>
|
||||||
|
nnoremap gi <cmd>lua vim.lsp.buf.implementation()<CR>
|
||||||
|
nnoremap <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
|
||||||
|
nnoremap <space>wa <cmd>lua vim.lsp.buf.add_workspace_folder()<CR>
|
||||||
|
nnoremap <space>wr <cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>
|
||||||
|
nnoremap <space>wl <cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>
|
||||||
|
nnoremap <space>D <cmd>lua vim.lsp.buf.type_definition()<CR>
|
||||||
|
nnoremap <space>rn <cmd>lua vim.lsp.buf.rename()<CR>
|
||||||
|
nnoremap <space>ca <cmd>lua vim.lsp.buf.code_action()<CR>
|
||||||
|
nnoremap gr <cmd>lua vim.lsp.buf.references()<CR>
|
||||||
|
nnoremap <space>e <cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>
|
||||||
|
nnoremap [d <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
|
||||||
|
nnoremap ]d <cmd>lua vim.lsp.diagnostic.goto_next()<CR>
|
||||||
|
nnoremap <space>q <cmd>lua vim.lsp.diagnostic.set_loclist()<CR>
|
||||||
|
nnoremap <space>f <cmd>lua vim.lsp.buf.formatting()<CR>
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:gutentags_cache_dir="~/.config/nvim/gutentags"
|
let g:gutentags_cache_dir="~/.config/nvim/gutentags"
|
||||||
|
Loading…
Reference in New Issue
Block a user