Use conform.nvim for fold-preserving formatting

This commit is contained in:
Alexander Gehrke 2024-04-04 18:18:22 +02:00
parent 855db2feee
commit b1e951ef1d
5 changed files with 52 additions and 17 deletions

View file

@ -10,7 +10,7 @@ local on_attach = function(args)
--
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
-- stylua: ignore start
for _, mapping in ipairs({
{ 'gD', vim.lsp.buf.declaration, "Go to declaration" },
{ 'gd', require('telescope.builtin').lsp_definitions, "Go to definition" },
@ -25,29 +25,31 @@ local on_attach = function(args)
{ '[d', vim.diagnostic.goto_prev, "Go to previous diagnostic" },
{ '[d', vim.diagnostic.goto_prev, "Go to next diagnostic" },
{ '<M-q>', vim.diagnostic.setloclist, "Add buffer diagnostics to location list" },
{ "<Leader>f", function() vim.lsp.buf.format { async = true } end, "Format buffer" },
{ "<leader>dc", function() require("dap").continue() end, "Debug: Continue" },
{ "<leader>dK", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
{ "<leader>dt", function() require("dap").toggle_breakpoint() end, "Debug: Toggle breakpoint" },
{ "<leader>dso", function() require("dap").step_over() end, "Debug: Step over" },
{ "<leader>dsi", function() require("dap").step_into() end, "Debug: Step into" },
{ "<leader>dl", function() require("dap").run_last() end, "Debug: Run last" },
{ "<F5>", function() require("dap").continue() end, "Debug: Continue" },
{ "<M-h>", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
{ "<F5>", function() require("dap").continue() end, "Debug: Continue" },
{ "<M-h>", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
{ "<F7>", function() require("dap").step_over() end, "Debug: Step over" },
{ "<F8>", function() require("dap").step_into() end, "Debug: Step into" },
{ "<leader>aa", vim.diagnostic.setqflist, "Add all diagnostics to quickfix list" },
{ "<leader>aw", function() vim.diagnostic.setqflist({ severity = "W" }) end, "Add all warnings to quickfix list" },
{ "<leader>ae", function() vim.diagnostic.setqflist({ severity = "E" }) end, "Add all errors to quickfix list" },
}) do
vim.keymap.set('n', mapping[1], mapping[2], { silent = true, buffer = args.buf, desc = mapping[3] })
vim.keymap.set("n", mapping[1], mapping[2], { silent = true, buffer = args.buf, desc = mapping[3] })
end
-- stylua: ignore end
vim.keymap.set("n", "<leader>dr", function() require("dap").repl.toggle() end, { silent = true, desc = "Toogle debug REPL" })
vim.keymap.set("n", "<leader>dr", function()
require("dap").repl.toggle()
end, { silent = true, desc = "Toogle debug REPL" })
if client.server_capabilities.signatureHelpProvider then
vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]]
vim.cmd [[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]]
vim.cmd([[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]])
vim.cmd([[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]])
end
if client.server_capabilities.documentHighlightingProvider then