AutoYADM commit: 2024-11-12 17:00:02
This commit is contained in:
parent
35daf0b6f2
commit
aa8ee1ee93
2 changed files with 6 additions and 4 deletions
|
@ -52,11 +52,12 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
|||
local md_utils = require("md-utils")
|
||||
local isList = md_utils.isCursorInList()
|
||||
if isList then
|
||||
print("Markdown list!")
|
||||
-- print("Markdown list!")
|
||||
vim.api.nvim_command("MDListItemBelow")
|
||||
else
|
||||
print("Not markdown list")
|
||||
-- print("Not markdown list")
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", true, true, true), "n", true)
|
||||
end
|
||||
vim.api.nvim_input("<CR>")
|
||||
end, { desc = "Continue List", silent = true, remap = true })
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.spell = true
|
||||
|
|
|
@ -4,9 +4,10 @@ local ts_utils = require("nvim-treesitter.ts_utils")
|
|||
|
||||
M.isCursorInList = function()
|
||||
local node = ts_utils.get_node_at_cursor()
|
||||
print(node)
|
||||
while node do
|
||||
-- Check if node is a list item
|
||||
if node:type() == "list_item" then
|
||||
if (node:type() == "list_item") or (node:type() == "list_item_content") then
|
||||
return true
|
||||
end
|
||||
node = node:parent()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue