feat(ui): add undotree and improve folding with nvim-ufo

This commit is contained in:
sankalp committed 2025-10-17 11:57:50 +05:45
1 parent 5d9924dbc7
commit 047854ba58
3 files changed
+45 -11

No files matched your search

+3 -2
View File
@@ -21,10 +21,10 @@
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"mdx.nvim": { "branch": "main", "commit": "464a74be368dce212cff02f6305845dc7f209ab3" },
"messenger.nvim": { "branch": "main", "commit": "309fec2ddd3de55eba2781b676931b37ce8190af" },
"mini.nvim": { "branch": "main", "commit": "89eecd8b4c15f8de72dd4b5244534abed8dc086f" },
"mini.nvim": { "branch": "main", "commit": "8a7cf7eee8d89bd1b83f6d72f7f3b5598e7ae2cb" },
"neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" },
"neoscroll.nvim": { "branch": "master", "commit": "f957373912e88579e26fdaea4735450ff2ef5c9c" },
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
"nvim-genghis": { "branch": "main", "commit": "b9487d6c4ccdecf3c7cd4e3e7107b42c65e20106" },
"nvim-lint": { "branch": "master", "commit": "9da1fb942dd0668d5182f9c8dee801b9c190e2bb" },
"nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" },
@@ -38,6 +38,7 @@
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "1cb11cc658ee24a9826e3b909ca0b0f5e60597c7" },
"todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" },
"toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" },
"undotree": { "branch": "master", "commit": "0f1c9816975b5d7f87d5003a19c53c6fd2ff6f7f" },
"uv.nvim": { "branch": "main", "commit": "be4a7d47a976249282bb2f71fc773ac2f5325973" },
"vim-suda": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
"vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" },
-5
View File
@@ -45,11 +45,6 @@ local options = {
wildmode = 'longest:full,full',
wildoptions = 'pum',
-- Folds (keep open by default, works well with nvim-ufo)
foldlevel = 99,
foldlevelstart = 99,
foldenable = true,
-- Window
splitright = true,
splitbelow = true,
+42 -4
View File
@@ -27,17 +27,55 @@ return {
cmd = { 'MarkdownPreviewToggle', 'MarkdownPreview' },
},
-- fold
-- Better folding
{
'kevinhwang91/nvim-ufo',
event = { 'BufReadPost', 'BufNewFile' },
dependencies = { 'kevinhwang91/promise-async', event = 'BufReadPost' },
dependencies = 'kevinhwang91/promise-async',
event = 'BufReadPost',
keys = {
{
'zR',
function()
require('ufo').openAllFolds()
end,
},
{
'zM',
function()
require('ufo').closeAllFolds()
end,
},
{
'zr',
function()
require('ufo').openFoldsExceptKinds()
end,
},
{
'zm',
function()
require('ufo').closeFoldsWith()
end,
},
},
config = function()
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
vim.o.foldenable = true
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
provider_selector = function()
return { 'treesitter', 'indent' }
end,
})
end,
},
-- Undo tree
{
'mbbill/undotree',
cmd = 'UndotreeToggle',
keys = { { '<leader>u', '<cmd>UndotreeToggle<cr>', desc = 'Undo Tree' } },
},
}