From 88a7dd2381e4887a57ac971ce991b8d28862ff7a Mon Sep 17 00:00:00 2001 From: fcying Date: Thu, 17 Oct 2024 19:42:01 +0800 Subject: [PATCH] feat: add markview --- lua/_lazy.lua | 1 + lua/plugins/markview.lua | 12 ++++++ lua/plugins/todo-comments.lua | 1 - lua/plugins/treesitter.lua | 2 +- lua/plugins/whichkey.lua | 75 +++++++++++++++-------------------- 5 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 lua/plugins/markview.lua diff --git a/lua/_lazy.lua b/lua/_lazy.lua index 768a75b1..1e32e0f7 100644 --- a/lua/_lazy.lua +++ b/lua/_lazy.lua @@ -58,6 +58,7 @@ local plugins = { -- filetype {{{ --{ 'kevinhwang91/nvim-bqf', ft = 'qf' }, + { import = "plugins.markview" }, { "Vimjas/vim-python-pep8-indent", ft = "python" }, { "wsdjeg/vim-autohotkey", ft = "autohotkey" }, diff --git a/lua/plugins/markview.lua b/lua/plugins/markview.lua new file mode 100644 index 00000000..b1d7174f --- /dev/null +++ b/lua/plugins/markview.lua @@ -0,0 +1,12 @@ +return { + "OXY2DEV/markview.nvim", + ft = "markdown", + dependencies = { + "nvim-treesitter/nvim-treesitter", + "nvim-tree/nvim-web-devicons" + }, + opts = { + hybrid_modes = nil, + initial_state = false, + }, +} diff --git a/lua/plugins/todo-comments.lua b/lua/plugins/todo-comments.lua index f91b46fd..d3f3689e 100644 --- a/lua/plugins/todo-comments.lua +++ b/lua/plugins/todo-comments.lua @@ -1,6 +1,5 @@ return { "folke/todo-comments.nvim", - -- event = "VeryLazy", -- cmd = { "TodoTelescope", "TodoQuickFix", "TodoLocList" }, cmd = { "TodoTelescope" }, config = function() diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 69577af2..d038bbcc 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -40,7 +40,7 @@ return parser_install_dir = parser_install_dir, ensure_installed = { "vim", "vimdoc", "lua", "query", "comment", - "cpp", "typescript", "vue" + "cpp", "typescript", "vue", "latex", }, sync_install = #vim.api.nvim_list_uis() == 0, auto_install = false, diff --git a/lua/plugins/whichkey.lua b/lua/plugins/whichkey.lua index f021292b..b63096d1 100644 --- a/lua/plugins/whichkey.lua +++ b/lua/plugins/whichkey.lua @@ -1,52 +1,39 @@ +local opts = { + icons = { mappings = false }, + delay = function(ctx) + return ctx.plugin and 0 or 200 + end, + plugins = { + presets = { + g = true, + z = true, + } + }, + -- Start hidden and wait for a key to be pressed before showing the popup + -- Only used by enabled xo mapping modes. + ---@param ctx { mode: string, operator: string } + defer = function(ctx) + return ctx.mode == "V" or ctx.mode == "" + end, + replace = { + desc = { + { "%(?(.*)%)?", "%1" }, + { "^%+", "" }, + { "<[cC]md>", "" }, + { "<[cC][rR]>", "" }, + { "<[sS]ilent>", "" }, + { "^lua%s+", "" }, + { "^call%s+", "" }, + { "^:%s*", "" }, + }, + }, +} return { "folke/which-key.nvim", event = "VeryLazy", config = function() local wk = require("which-key") - wk.setup({ - icons = { mappings = false }, - delay = function(ctx) - return ctx.plugin and 0 or 200 - end, - plugins = { - presets = { - g = true, - z = true, - } - }, - -- Start hidden and wait for a key to be pressed before showing the popup - -- Only used by enabled xo mapping modes. - ---@param ctx { mode: string, operator: string } - defer = function(ctx) - return ctx.mode == "V" or ctx.mode == "" - end, - replace = { - key = { - function(key) - return require("which-key.view").format(key) - end, - -- { "", "SPC" }, - }, - desc = { - { "%(?(.*)%)?", "%1" }, - { "^%+", "" }, - { "<[cC]md>", "" }, - { "<[cC][rR]>", "" }, - { "<[sS]ilent>", "" }, - { "^lua%s+", "" }, - { "^call%s+", "" }, - { "^:%s*", "" }, - }, - }, - triggers = { - { "", mode = "nxso" }, - { "g", mode = "n" }, - { "f", mode = "n" }, - { "v", mode = "n" }, - { "[", mode = "nv" }, - { "]", mode = "nv" }, - } - }) + wk.setup(opts) wk.add({ { "c", group = "cd ..." }, { "d", group = "delete ..." },