From 690eb0360a1db7fe9ec9cd1c1564bc6090688753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=AE=E6=99=A8?= Date: Wed, 5 Jun 2024 17:20:00 +0800 Subject: [PATCH] move keymap set to keys --- lua/lazyvim/plugins/extras/ui/fold.lua | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lua/lazyvim/plugins/extras/ui/fold.lua b/lua/lazyvim/plugins/extras/ui/fold.lua index 5a684bf7..528a6e9c 100644 --- a/lua/lazyvim/plugins/extras/ui/fold.lua +++ b/lua/lazyvim/plugins/extras/ui/fold.lua @@ -49,6 +49,17 @@ return { "kevinhwang91/nvim-ufo", event = { "BufRead", "BufNewFile" }, dependencies = { "kevinhwang91/promise-async" }, + keys = { + { + "K", + function() + if not require("ufo").peekFoldedLinesUnderCursor() then + vim.lsp.buf.hover() + end + end, + desc = "Peek fold or hover", + }, + }, init = function() vim.o.foldcolumn = "1" vim.o.foldlevel = 99 @@ -102,15 +113,5 @@ return { }, } end, - config = function(_, opts) - require("ufo").setup(opts) - - local map = require("lazyvim.util").safe_keymap_set - map("n", "K", function() - if not require("ufo").peekFoldedLinesUnderCursor() then - vim.lsp.buf.hover() - end - end, { desc = "Peek folded lines under cursor or hover" }) - end, }, }