From 18c27d31ebd29519ce6d815b3dd98cea4e0da185 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sat, 24 Feb 2024 19:27:24 -0600 Subject: [PATCH] feat(nvim): add `vim.b.ufo_foldlevel_max` --- dots/.config/nvim/after/ftplugin/orgagenda.lua | 1 + dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 dots/.config/nvim/after/ftplugin/orgagenda.lua diff --git a/dots/.config/nvim/after/ftplugin/orgagenda.lua b/dots/.config/nvim/after/ftplugin/orgagenda.lua new file mode 100644 index 00000000..c246b830 --- /dev/null +++ b/dots/.config/nvim/after/ftplugin/orgagenda.lua @@ -0,0 +1 @@ +vim.b.ufo_foldlevel_max = 1 diff --git a/dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua b/dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua index 235a1ef1..3aab1827 100644 --- a/dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua +++ b/dots/.config/nvim/lua/plugins/configs/nvim-ufo.lua @@ -19,6 +19,9 @@ local change_buf_foldlevel_by = function(num) else foldlevel = 0 end + if vim.b.ufo_foldlevel and foldlevel > vim.b.ufo_foldlevel_max then + return + end set_buf_foldlevel(foldlevel) end