From e1ea3de264ea2e4e8568fc8f1cabdf42eb864ad9 Mon Sep 17 00:00:00 2001 From: ronload <91997734+ronload@users.noreply.github.com> Date: Tue, 7 Jul 2026 17:42:23 +0800 Subject: [PATCH] feat(nvim): enhance markdown editting experience --- nvim/after/ftplugin/markdown.lua | 8 ++++++++ nvim/lua/plugins/render-markdown.lua | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 nvim/after/ftplugin/markdown.lua diff --git a/nvim/after/ftplugin/markdown.lua b/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..85c5c4a --- /dev/null +++ b/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,8 @@ +vim.opt_local.wrap = true +vim.opt_local.linebreak = true +vim.opt_local.breakindent = true +vim.opt_local.breakindentopt = "list:-1" + +local opts = { buffer = true, expr = true, silent = true } +vim.keymap.set({ "n", "x" }, "j", "v:count == 0 ? 'gj' : 'j'", opts) +vim.keymap.set({ "n", "x" }, "k", "v:count == 0 ? 'gk' : 'k'", opts) diff --git a/nvim/lua/plugins/render-markdown.lua b/nvim/lua/plugins/render-markdown.lua index 3af005e..cc3fd36 100644 --- a/nvim/lua/plugins/render-markdown.lua +++ b/nvim/lua/plugins/render-markdown.lua @@ -3,10 +3,10 @@ return { ft = { "markdown" }, dependencies = { "nvim-treesitter/nvim-treesitter" }, opts = { + render_modes = true, win_options = { - wrap = { default = false, rendered = true }, - linebreak = { default = false, rendered = true }, - breakindent = { default = false, rendered = true }, + conceallevel = { default = vim.o.conceallevel, rendered = 2 }, + concealcursor = { default = vim.o.concealcursor, rendered = "nc" }, }, }, }