AutoYADM commit: 2024-11-12 15:30:02
This commit is contained in:
parent
52e9bd2535
commit
35daf0b6f2
2 changed files with 28 additions and 1 deletions
|
@ -47,7 +47,17 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
buffer = 0,
|
buffer = 0,
|
||||||
command = "silent! write",
|
command = "silent! write",
|
||||||
})
|
})
|
||||||
vim.keymap.set("i", "<Cr>", "<cmd>MDListItemBelow<cr>", { desc = "Continue List", silent = true, remap = true })
|
-- TODO: fix the <CR> not being sent\ recognize other types too?
|
||||||
|
vim.keymap.set("i", "<Cr>", function()
|
||||||
|
local md_utils = require("md-utils")
|
||||||
|
local isList = md_utils.isCursorInList()
|
||||||
|
if isList then
|
||||||
|
print("Markdown list!")
|
||||||
|
else
|
||||||
|
print("Not markdown list")
|
||||||
|
end
|
||||||
|
vim.api.nvim_input("<CR>")
|
||||||
|
end, { desc = "Continue List", silent = true, remap = true })
|
||||||
vim.opt_local.wrap = true
|
vim.opt_local.wrap = true
|
||||||
vim.opt_local.spell = true
|
vim.opt_local.spell = true
|
||||||
-- local secondary = "#379393"
|
-- local secondary = "#379393"
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local ts_utils = require("nvim-treesitter.ts_utils")
|
||||||
|
|
||||||
|
M.isCursorInList = function()
|
||||||
|
local node = ts_utils.get_node_at_cursor()
|
||||||
|
while node do
|
||||||
|
-- Check if node is a list item
|
||||||
|
if node:type() == "list_item" then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
node = node:parent()
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Loading…
Add table
Add a link
Reference in a new issue