nvim: Add conform.nvim formatter
In the process of moving away from null-ls, added formatting with the help of conform.nvim. Brings one new command, :ConformInfo which can also be reached via `<leader>vc`. AutoFormat on saving remains disabled by default but can be enabled with :FormatEnable (and disabled again with :FormatDisable) or quickly through `<localleader>lL`. Manual formatting works like before with `<localleader>ll`. Uses the formatters set in the plugin (similar setup to null-ls before) but automatically falls back to lsp formatters if it does not have its own and lsp has one enabled.
This commit is contained in:
parent
1def627edd
commit
293dc8a467
8 changed files with 81 additions and 48 deletions
|
|
@ -100,7 +100,6 @@ local function on_attach(client, bufnr)
|
|||
{ buffer = bufnr, desc = "Implementation" }
|
||||
)
|
||||
end
|
||||
map("n", "<localleader>ll", "<cmd>lua vim.lsp.buf.format()<CR>", { buffer = bufnr, desc = "Format document" })
|
||||
map("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", { buffer = bufnr, desc = "Hover definition" })
|
||||
map("n", "<localleader>lc", "<cmd>lua vim.lsp.buf.declaration()<cr>", { buffer = bufnr, desc = "Declaration" })
|
||||
map(
|
||||
|
|
@ -116,10 +115,6 @@ local function on_attach(client, bufnr)
|
|||
vim.diagnostic.disable(0)
|
||||
end
|
||||
end, { buffer = bufnr, desc = "Disable buffer diagnostics" })
|
||||
|
||||
if vim.g.format_on_save then
|
||||
require("lsp-setup.utils").format_on_save(client)
|
||||
end
|
||||
end
|
||||
|
||||
-- Display diagnostics as virtual text only if not in insert mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue