stuff
This commit is contained in:
parent
282dc5662d
commit
eaeed514cf
8 changed files with 159 additions and 1 deletions
13
configs/lspconfig.lua
Normal file
13
configs/lspconfig.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
local base = require("plugins.configs.lspconfig")
|
||||
local on_attach = base.on_attach
|
||||
local capabilities = base.capabilities
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.clangd.setup {
|
||||
on_attach = function(client, bufnr)
|
||||
client.server_capabilities.signatureHelpProvider = false
|
||||
on_attach(client, bufnr)
|
||||
end,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
25
configs/none-ls.lua
Normal file
25
configs/none-ls.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
local none_ls = require("none-ls")
|
||||
|
||||
local opts = {
|
||||
sources = {
|
||||
none_ls.builtins.formatting.clang_format,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
return opts
|
||||
Loading…
Add table
Add a link
Reference in a new issue