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
|
@ -47,15 +47,12 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
|
|||
buffer = 0,
|
||||
command = "silent! write",
|
||||
})
|
||||
-- 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!")
|
||||
vim.api.nvim_command("MDListItemBelow")
|
||||
else
|
||||
-- print("Not markdown list")
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", true, true, true), "n", true)
|
||||
end
|
||||
end, { desc = "Continue List", silent = true, remap = true })
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -61,7 +61,7 @@ YMMMUP^
|
|||
-- { action = loadObsidian, desc = " Obsidian Tags", icon = " ", key = "o" },
|
||||
{ action = "ene | startinsert", desc = " New File", icon = " ", key = "n" },
|
||||
{ action = function () vim.api.nvim_input("<CMD>ObsidianQuickSwitch<CR>") end, desc = " Obsidian", icon = " ", key = "o"},
|
||||
-- { action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" },
|
||||
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" },
|
||||
-- { action = 'lua LazyVim.pick("live_grep")()', desc = " Grep", icon = " ", key = "/" },
|
||||
-- { action = function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, desc = " Git", icon = " ", key = "g" },
|
||||
{ action = 'lua LazyVim.pick.config_files()()', desc = " Search Config", icon = " ", key = "c" },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue