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,
|
buffer = 0,
|
||||||
command = "silent! write",
|
command = "silent! write",
|
||||||
})
|
})
|
||||||
-- TODO: fix the <CR> not being sent\ recognize other types too?
|
|
||||||
vim.keymap.set("i", "<Cr>", function()
|
vim.keymap.set("i", "<Cr>", function()
|
||||||
local md_utils = require("md-utils")
|
local md_utils = require("md-utils")
|
||||||
local isList = md_utils.isCursorInList()
|
local isList = md_utils.isCursorInList()
|
||||||
if isList then
|
if isList then
|
||||||
-- print("Markdown list!")
|
|
||||||
vim.api.nvim_command("MDListItemBelow")
|
vim.api.nvim_command("MDListItemBelow")
|
||||||
else
|
else
|
||||||
-- print("Not markdown list")
|
|
||||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", true, true, true), "n", true)
|
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", true, true, true), "n", true)
|
||||||
end
|
end
|
||||||
end, { desc = "Continue List", silent = true, remap = true })
|
end, { desc = "Continue List", silent = true, remap = true })
|
||||||
|
|
|
@ -1,20 +1,8 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local ts_utils = require("nvim-treesitter.ts_utils")
|
|
||||||
|
|
||||||
M.isCursorInList = function()
|
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()
|
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
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -61,7 +61,7 @@ YMMMUP^
|
||||||
-- { action = loadObsidian, desc = " Obsidian Tags", icon = " ", key = "o" },
|
-- { action = loadObsidian, desc = " Obsidian Tags", icon = " ", key = "o" },
|
||||||
{ action = "ene | startinsert", desc = " New File", icon = " ", key = "n" },
|
{ 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 = 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 = 'lua LazyVim.pick("live_grep")()', desc = " Grep", icon = " ", key = "/" },
|
||||||
-- { action = function() LazyVim.lazygit( { cwd = LazyVim.root.git() }) end, desc = " Git", icon = " ", key = "g" },
|
-- { 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" },
|
{ action = 'lua LazyVim.pick.config_files()()', desc = " Search Config", icon = " ", key = "c" },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue