From 7543e338db6ad1d5d56548b6586209175e16cce6 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Fri, 1 Dec 2023 15:26:02 -0500 Subject: [PATCH] Add nvim-ufo for fancier folding --- lazy-lock.json | 4 +++- lazyvim.json | 1 - lua/plugins/folding.lua | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/folding.lua diff --git a/lazy-lock.json b/lazy-lock.json index b4508dd..7008c83 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -3,7 +3,6 @@ "LuaSnip": { "branch": "master", "commit": "df58ee1664cfda71479cd2bbd56114f56599eba6" }, "SchemaStore.nvim": { "branch": "main", "commit": "54a4ea14b70cd3fc9db8217bb4ac9e1f78bfa390" }, "aerial.nvim": { "branch": "master", "commit": "88764566f96bf900a64b3dcd6d178cfb69b1c8ce" }, - "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, "bufferline.nvim": { "branch": "main", "commit": "9e8d2f695dd50ab6821a6a53a840c32d2067a78a" }, "catppuccin": { "branch": "main", "commit": "a2107df4379d66e72a36a89792603151cebec1bf" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, @@ -18,6 +17,7 @@ "copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" }, "copilot.lua": { "branch": "master", "commit": "73047082d72fcfdde1f73b7f17ad495cffcbafaa" }, "crates.nvim": { "branch": "main", "commit": "406295abeb7eedae3bcee3f0db690ada605c629c" }, + "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, "dial.nvim": { "branch": "master", "commit": "019bbe9daea397c93a99adc747f8f071379fee5c" }, "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, "dressing.nvim": { "branch": "master", "commit": "fe3071330a0720ce3695ac915820c8134b22d1b0" }, @@ -65,11 +65,13 @@ "nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "b8ff464f2afc2000f6c72fa331a8fc090cb46b39" }, + "nvim-ufo": { "branch": "main", "commit": "c35c447ae65e2879b10d2429489088509d75c329" }, "nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" }, "oil.nvim": { "branch": "master", "commit": "e89a8f8adeef2dfab851fd056d38ee7afc97c249" }, "persistence.nvim": { "branch": "main", "commit": "ad538bfd5336f1335cdb6fd4e0b0eebfa6e12f32" }, "plenary.nvim": { "branch": "master", "commit": "366b0837486f60ae0e7550c15de8ff66d057c4cd" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, + "promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "ssr.nvim": { "branch": "main", "commit": "bb323ba621ac647b4ac5638b47666e3ef3c279e1" }, "telescope-emoji.nvim": { "branch": "master", "commit": "86248d97be84a1ce83f0541500ef9edc99ea2aa1" }, diff --git a/lazyvim.json b/lazyvim.json index 79e42b3..d4e000c 100644 --- a/lazyvim.json +++ b/lazyvim.json @@ -15,7 +15,6 @@ "lazyvim.plugins.extras.lang.yaml", "lazyvim.plugins.extras.linting.eslint", "lazyvim.plugins.extras.test.core", - "lazyvim.plugins.extras.ui.alpha", "lazyvim.plugins.extras.util.mini-hipatterns", "lazyvim.plugins.extras.util.project" ], diff --git a/lua/plugins/folding.lua b/lua/plugins/folding.lua new file mode 100644 index 0000000..c393d18 --- /dev/null +++ b/lua/plugins/folding.lua @@ -0,0 +1,33 @@ +return { + -- add folding range to capabilities + { + "neovim/nvim-lspconfig", + opts = { + capabilities = { + textDocument = { + foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true, + }, + }, + }, + }, + }, + -- add nvim-ufo + { + "kevinhwang91/nvim-ufo", + dependencies = "kevinhwang91/promise-async", + event = "BufReadPost", + opts = {}, + + init = function() + -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself + vim.keymap.set("n", "zR", function() + require("ufo").openAllFolds() + end) + vim.keymap.set("n", "zM", function() + require("ufo").closeAllFolds() + end) + end, + }, +}