summary refs log tree commit diff
path: root/.vim/after/ftplugin
diff options
context:
space:
mode:
Diffstat (limited to '.vim/after/ftplugin')
-rw-r--r--.vim/after/ftplugin/markdown.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/.vim/after/ftplugin/markdown.lua b/.vim/after/ftplugin/markdown.lua
index c827d17..226f9ed 100644
--- a/.vim/after/ftplugin/markdown.lua
+++ b/.vim/after/ftplugin/markdown.lua
@@ -44,9 +44,11 @@ vim.keymap.set('n', 'o', function()
   local node = vim.treesitter.get_node_at_pos(0, cursor[1]-1, cursor[2], {})
   while node do
     if node:type() == 'list_item' then
-      vim.api.nvim_buf_set_lines(0, cursor[1], cursor[1], false, {
-        vim.treesitter.get_node_text(node:child(0), 0, {})
-      })
+      local ln = vim.treesitter.get_node_text(node:child(0), 0, {})
+      local ln_start = string.match(ln, '^(%d+)%.'); if ln_start ~= nil then
+        ln = ln:gsub(ln_start, tonumber(ln_start)+1)
+      end
+      vim.api.nvim_buf_set_lines(0, cursor[1], cursor[1], false, {ln})
       vim.api.nvim_feedkeys('jA', 'n', false)
       return
     end