format lspconfig
This commit is contained in:
parent
4ee5f69566
commit
a94b098588
@ -23,23 +23,29 @@ return {
|
|||||||
vim.api.nvim_set_hl(
|
vim.api.nvim_set_hl(
|
||||||
0,
|
0,
|
||||||
'LspReferenceText',
|
'LspReferenceText',
|
||||||
{ bold = true,
|
{
|
||||||
|
bold = true,
|
||||||
ctermbg = 'red',
|
ctermbg = 'red',
|
||||||
bg = '#5a524c' }
|
bg = '#5a524c'
|
||||||
|
}
|
||||||
)
|
)
|
||||||
vim.api.nvim_set_hl(
|
vim.api.nvim_set_hl(
|
||||||
0,
|
0,
|
||||||
'LspReferenceRead',
|
'LspReferenceRead',
|
||||||
{ bold = true,
|
{
|
||||||
|
bold = true,
|
||||||
ctermbg = 'red',
|
ctermbg = 'red',
|
||||||
bg = 'DarkGreen' }
|
bg = 'DarkGreen'
|
||||||
|
}
|
||||||
)
|
)
|
||||||
vim.api.nvim_set_hl(
|
vim.api.nvim_set_hl(
|
||||||
0,
|
0,
|
||||||
'LspReferenceWrite',
|
'LspReferenceWrite',
|
||||||
{ bold = true,
|
{
|
||||||
|
bold = true,
|
||||||
ctermbg = 'red',
|
ctermbg = 'red',
|
||||||
bg = 'DarkRed' }
|
bg = 'DarkRed'
|
||||||
|
}
|
||||||
)
|
)
|
||||||
local diagnostics = {
|
local diagnostics = {
|
||||||
Error = ' ',
|
Error = ' ',
|
||||||
@ -50,9 +56,9 @@ return {
|
|||||||
}
|
}
|
||||||
local signs = {
|
local signs = {
|
||||||
{ name = 'DiagnosticSignError', text = diagnostics.Error },
|
{ name = 'DiagnosticSignError', text = diagnostics.Error },
|
||||||
{ name = 'DiagnosticSignWarn', text = diagnostics.Warning },
|
{ name = 'DiagnosticSignWarn', text = diagnostics.Warning },
|
||||||
{ name = 'DiagnosticSignHint', text = diagnostics.Hint },
|
{ name = 'DiagnosticSignHint', text = diagnostics.Hint },
|
||||||
{ name = 'DiagnosticSignInfo', text = diagnostics.Information },
|
{ name = 'DiagnosticSignInfo', text = diagnostics.Information },
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, sign in ipairs(signs) do
|
for _, sign in ipairs(signs) do
|
||||||
@ -116,14 +122,14 @@ return {
|
|||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.server_capabilities.documentFormattingProvider then
|
if client.server_capabilities.documentFormattingProvider then
|
||||||
vim.keymap.set('n', '<space>f', function()
|
vim.keymap.set('n', '<space>f', function()
|
||||||
vim.lsp.buf.format({ timeout_ms = 10000 })
|
vim.lsp.buf.format({ timeout_ms = 10000 })
|
||||||
end,
|
end,
|
||||||
{ noremap = true, silent = false, desc = 'Format file', buffer = bufnr })
|
{ noremap = true, silent = false, desc = 'Format file', buffer = bufnr })
|
||||||
end
|
end
|
||||||
if client.server_capabilities.documentRangeFormattingProvider then
|
if client.server_capabilities.documentRangeFormattingProvider then
|
||||||
vim.keymap.set('x', '<space>f', function()
|
vim.keymap.set('x', '<space>f', function()
|
||||||
vim.lsp.buf.format({ timeout_ms = 10000 })
|
vim.lsp.buf.format({ timeout_ms = 10000 })
|
||||||
end,
|
end,
|
||||||
{ noremap = true, silent = false, desc = 'Format visual', buffer = bufnr })
|
{ noremap = true, silent = false, desc = 'Format visual', buffer = bufnr })
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -193,7 +199,7 @@ return {
|
|||||||
return lspconfig.util.find_git_ancestor(fname)
|
return lspconfig.util.find_git_ancestor(fname)
|
||||||
end,
|
end,
|
||||||
single_file_support = true, -- suggested
|
single_file_support = true, -- suggested
|
||||||
on_attach = on_attach -- on_attach is the on_attach function you defined
|
on_attach = on_attach -- on_attach is the on_attach function you defined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lspconfig.neocmake.setup({})
|
lspconfig.neocmake.setup({})
|
||||||
@ -206,7 +212,8 @@ return {
|
|||||||
server = {
|
server = {
|
||||||
capabilities = clangd_capabilities,
|
capabilities = clangd_capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
cmd = { 'clangd', '--compile-commands-dir=build_nvim', '--query-driver', '/opt/cortex-a78-2022.08-gcc12.1-linux5.15/bin/aarch64-linux-gnu-g*' },
|
cmd = { 'clangd', '--compile-commands-dir=build_nvim', '--query-driver',
|
||||||
|
'/opt/cortex-a78-2022.08-gcc12.1-linux5.15/bin/aarch64-linux-gnu-g*' },
|
||||||
root_dir = lspconfig.util.root_pattern(
|
root_dir = lspconfig.util.root_pattern(
|
||||||
'.clangd',
|
'.clangd',
|
||||||
'.clang-tidy',
|
'.clang-tidy',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user