From 59d604091e4d57469ff750ff0f45731d54c68195 Mon Sep 17 00:00:00 2001 From: zymon Date: Tue, 27 Aug 2024 15:42:44 +0200 Subject: [PATCH] ultra folding experience --- lua/znvim/keymaps.lua | 4 ++++ lua/znvim/plugins/editor.lua | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lua/znvim/keymaps.lua b/lua/znvim/keymaps.lua index 24f52fc..3a4a66b 100644 --- a/lua/znvim/keymaps.lua +++ b/lua/znvim/keymaps.lua @@ -37,3 +37,7 @@ vim.keymap.set("n", "", "bprevious", { desc = "prev buffer" }) vim.keymap.set("n", "", "bnext", { desc = "next buffer" }) vim.keymap.set("n", "[b", "bprevious", { desc = "prev buffer" }) vim.keymap.set("n", "]b", "bnext", { desc = "next buffer" }) + +vim.keymap.set("n", "uf", function () + vim.opt.foldcolumn = vim.opt.foldcolumn:get() == "0" and "4" or "0" +end, { desc = "toggle fold column" }) diff --git a/lua/znvim/plugins/editor.lua b/lua/znvim/plugins/editor.lua index e83c3b3..6fc78ba 100644 --- a/lua/znvim/plugins/editor.lua +++ b/lua/znvim/plugins/editor.lua @@ -119,4 +119,20 @@ return { }, }, + + { -- better folding + "https://github.com/kevinhwang91/nvim-ufo", + dependencies = { + "https://github.com/kevinhwang91/promise-async", + }, + event = "BufReadPost", + config = function() + local ufo = require("ufo") + -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself + vim.keymap.set("n", "zR", ufo.openAllFolds) + vim.keymap.set("n", "zM", ufo.closeAllFolds) + ufo.setup() + end, + }, + }