Try folds and some other changes

This commit is contained in:
2024-10-16 15:56:59 +02:00
parent 50b8c88e92
commit a56b8f7029
5 changed files with 49 additions and 36 deletions

View File

@@ -1,18 +1,26 @@
local lsp_attach = function(client, buf)
vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()")
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc")
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc")
vim.api.nvim_set_option_value("formatexpr", "v:lua.vim.lsp.formatexpr()", { buf = buf })
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = buf })
vim.api.nvim_set_option_value("tagfunc", "v:lua.vim.lsp.tagfunc", { buf = buf })
vim.lsp.inlay_hint.enable(true, nil)
local bufopts = { noremap = true, silent = true, buffer = buf }
local wk = require("which-key")
local diag_next = function()
vim.diagnostic.jump({ count = 1, float = true })
end
local diag_prev = function()
vim.diagnostic.jump({ count = -1, float = true })
end
wk.add({
{ '<leader>e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" },
{ '<C-e>', require("telescope.builtin").diagnostics, bufopts, desc = "Show diagnostics under cursor" },
{ '<C-ü>d', vim.diagnostic.goto_prev, bufopts },
{ '<C-¨>d', vim.diagnostic.goto_next, bufopts },
{ '<leader>e', vim.diagnostic.open_float, bufopts, desc = "Show diagnostics in buffer" },
{ '[d', diag_prev, bufopts },
{ ']d', diag_next, bufopts },
{ 'gD', vim.lsp.buf.declaration, bufopts, desc = "Go to declaration" },
{ 'gd', vim.lsp.buf.definition, bufopts, desc = "Go to definition" },
@@ -36,6 +44,7 @@ return {
-- lsp
{
'williamboman/mason.nvim',
lazy = true,
config = true
},
{