fixes for neovim v0.8.0
This commit is contained in:
parent
e541136af7
commit
178d46f664
3 changed files with 13 additions and 21 deletions
3
init.lua
3
init.lua
|
@ -51,7 +51,8 @@ vim.cmd 'highlight Comment ctermfg=DarkGrey'
|
||||||
vim.cmd 'highlight SignColumn ctermbg=0'
|
vim.cmd 'highlight SignColumn ctermbg=0'
|
||||||
vim.cmd 'highlight LineNr ctermbg=0 ctermfg=248'
|
vim.cmd 'highlight LineNr ctermbg=0 ctermfg=248'
|
||||||
vim.cmd 'highlight Folded ctermbg=Green ctermfg=Black'
|
vim.cmd 'highlight Folded ctermbg=Green ctermfg=Black'
|
||||||
vim.cmd 'highlight Pmenu ctermbg=gray guibg=gray'
|
vim.cmd 'highlight Pmenu ctermbg=253 guibg=253'
|
||||||
|
vim.cmd 'highlight Pmenu ctermfg=232 guifg=232'
|
||||||
vim.cmd 'let g:airline_theme=\'papercolor\''
|
vim.cmd 'let g:airline_theme=\'papercolor\''
|
||||||
|
|
||||||
-- Find files using Telescope command-line sugar.
|
-- Find files using Telescope command-line sugar.
|
||||||
|
|
22
lua/lang.lua
22
lua/lang.lua
|
@ -20,14 +20,14 @@ local on_attach = function(client, bufnr)
|
||||||
local opts = {noremap = true, silent = true}
|
local opts = {noremap = true, silent = true}
|
||||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||||
buf_set_keymap('n', '[l', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||||
buf_set_keymap('n', ']l', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||||
|
buf_set_keymap('n', '[l', '<cmd>lua vim.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||||
|
buf_set_keymap('n', ']l', '<cmd>lua vim.diagnostic.set_loclist()<CR>', opts)
|
||||||
buf_set_keymap('n', '<leader>law', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
buf_set_keymap('n', '<leader>law', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||||
buf_set_keymap('n', '<leader>lrw', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
buf_set_keymap('n', '<leader>lrw', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
buf_set_keymap('n', '<leader>llw', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
buf_set_keymap('n', '<leader>llw', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||||
|
@ -36,16 +36,16 @@ local on_attach = function(client, bufnr)
|
||||||
buf_set_keymap('n', '<leader>lca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
buf_set_keymap('n', '<leader>lca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.server_capabilities.document_formatting then
|
||||||
buf_set_keymap("n", "<leader>lf",
|
buf_set_keymap("n", "<leader>lf",
|
||||||
"<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
"<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||||
elseif client.resolved_capabilities.document_range_formatting then
|
elseif client.server_capabilities.document_range_formatting then
|
||||||
buf_set_keymap("n", "<leader>lf",
|
buf_set_keymap("n", "<leader>lf",
|
||||||
"<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
"<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set autocommands conditional on server_capabilities
|
-- Set autocommands conditional on server_capabilities
|
||||||
if client.resolved_capabilities.document_highlight then
|
if client.server_capabilities.document_highlight then
|
||||||
vim.api.nvim_exec([[
|
vim.api.nvim_exec([[
|
||||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
||||||
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
|
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
|
||||||
|
@ -117,7 +117,7 @@ do
|
||||||
vim.lsp.handlers[method] = function(err, method, result, client_id, bufnr,
|
vim.lsp.handlers[method] = function(err, method, result, client_id, bufnr,
|
||||||
config)
|
config)
|
||||||
default_handler(err, method, result, client_id, bufnr, config)
|
default_handler(err, method, result, client_id, bufnr, config)
|
||||||
local diagnostics = vim.lsp.diagnostic.get_all()
|
local diagnostics = vim.diagnostic.get()
|
||||||
local qflist = {}
|
local qflist = {}
|
||||||
for bufnr, diagnostic in pairs(diagnostics) do
|
for bufnr, diagnostic in pairs(diagnostics) do
|
||||||
for _, d in ipairs(diagnostic) do
|
for _, d in ipairs(diagnostic) do
|
||||||
|
@ -128,6 +128,6 @@ do
|
||||||
table.insert(qflist, d)
|
table.insert(qflist, d)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setqflist(qflist)
|
-- setqflist(qflist)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,15 +9,6 @@ local on_attach = function(client, bufnr)
|
||||||
|
|
||||||
-- Mappings
|
-- Mappings
|
||||||
local opts = { noremap=true, silent=true }
|
local opts = { noremap=true, silent=true }
|
||||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'H', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<C-h>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
|
||||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- To get builtin LSP running, do something like:
|
-- To get builtin LSP running, do something like:
|
||||||
|
|
Reference in a new issue