AutoYADM commit: 2024-11-12 17:30:02
This commit is contained in:
parent
1af639b501
commit
9924f11acb
3 changed files with 2 additions and 17 deletions
|
@ -1,20 +1,8 @@
|
|||
local M = {}
|
||||
|
||||
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") or (node:type() == "list_item_content") then
|
||||
return true
|
||||
end
|
||||
node = node:parent()
|
||||
end
|
||||
-- Fall back to line-based check for list item pattern if not directly on `list_item` node
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
if line:match("^%s*[%-%*%+%d+%.]%s+") then
|
||||
if line:match("^%s*[%-%*%+]%s+") or line:match("^%s*%d+%.%s+") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue