added code folding via ufo plugin. enabled usage of *.lua files through the init.lua file.

This commit is contained in:
lobneroO 2023-12-12 15:47:45 +01:00
parent 39ae0829ac
commit 8baa1144ab
2 changed files with 28 additions and 1 deletions

View File

@ -229,7 +229,7 @@ require('lazy').setup({
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- --
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
-- { import = 'custom.plugins' }, { import = 'custom.plugins' },
}, {}) }, {})
-- [[ Setting options ]] -- [[ Setting options ]]

View File

@ -0,0 +1,27 @@
-- install plugin for code folding
return {
"kevinhwang91/nvim-ufo",
event = "BufRead",
dependencies = { "kevinhwang91/promise-async" },
config = function()
-- setup folding source: first lsp, then indent as fallback
require("ufo").setup({
provider_selector = function(bufnr, filetype, buftype)
return { 'lsp', 'indent' }
end
})
-- default settings to enable
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
-- remap keys for "fold all" and "unfold all"
vim.keymap.set('n', 'zR', require('ufo').openAllFolds, { desc = "Open all folds" })
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds, { desc = "Close all folds" })
end
}