diff --git a/nvim/after/plugin/ufo.lua b/nvim/after/plugin/ufo.lua new file mode 100644 index 0000000..9aa40b1 --- /dev/null +++ b/nvim/after/plugin/ufo.lua @@ -0,0 +1,20 @@ +-- https://github.com/kevinhwang91/nvim-ufo +local status_ok, ufo = pcall(require, "ufo") +if not status_ok then + return +end + +local keymap = vim.keymap.set +local opts = { noremap = true, silent = true } + +-- Options +vim.o.foldcolumn = "1" +vim.o.foldlevel = 99 +vim.o.foldlevelstart = 99 +vim.o.foldenable = true + +ufo.setup() + +-- Keymaps +keymap("n", "zR", require("ufo").openAllFolds, opts) +keymap("n", "zM", require("ufo").closeAllFolds, opts) diff --git a/nvim/lua/kogakure/lsp/handlers.lua b/nvim/lua/kogakure/lsp/handlers.lua index 6696de7..c58eac8 100644 --- a/nvim/lua/kogakure/lsp/handlers.lua +++ b/nvim/lua/kogakure/lsp/handlers.lua @@ -159,6 +159,12 @@ end local capabilities = vim.lsp.protocol.make_client_capabilities() +-- nvim-ufo - better folding +capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, +} + local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") if not status_ok then return diff --git a/nvim/lua/kogakure/plugins.lua b/nvim/lua/kogakure/plugins.lua index dcebbab..0478859 100644 --- a/nvim/lua/kogakure/plugins.lua +++ b/nvim/lua/kogakure/plugins.lua @@ -146,6 +146,7 @@ return packer.startup(function(use) use("simrat39/symbols-outline.nvim") -- Symbols Outline use("SmiteshP/nvim-navic") -- Statusline current context use("kevinhwang91/nvim-bqf") -- Better Quickfix + use({ "kevinhwang91/nvim-ufo", requires = "kevinhwang91/promise-async" }) -- Better folds -- Editing Files use("windwp/nvim-autopairs") -- Autopairs, integrates with both cmp and treesitter