1
0

Add plugin to fold comments and imports

This commit is contained in:
Patrick Auernig 2023-08-09 16:47:33 +02:00
parent a821534536
commit 1b1087ef55
2 changed files with 15 additions and 0 deletions

View File

@ -106,6 +106,9 @@ local function spec(use)
-- lsp manager
{ "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
-- code folding
{ "kevinhwang91/nvim-ufo" },
{ "kevinhwang91/promise-async" },
},
config = function()
require("valeth.packer.lsp")

View File

@ -1,4 +1,5 @@
local lsp = require("lsp-zero")
local ufo = require("ufo")
lsp.preset("recommended")
@ -40,6 +41,8 @@ lsp.set_sign_icons({
lsp.on_attach(function(_, buffnr)
local opts = { buffer = buffnr, remap = false }
ufo.attach(buffnr)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
@ -70,4 +73,13 @@ lsp.configure("rust_analyzer", {
}
})
vim.opt.foldcolumn = "0"
vim.opt.foldlevel = 99
vim.opt.foldlevelstart = 99
vim.opt.foldenable = true
ufo.setup {
close_fold_kinds = {"comment", "imports"},
}
lsp.setup()