author: Chenzhu-Xie name: Library/xczphysics/CONFIG/Nearest_Pattern/Delete tags: meta/library
warning Warning need
func() findNearestInlinePatternfrom ^Library/xczphysics/CONFIG/Nearest_Pattern/Duplicate
command.define{
name = "Cursor: Delete Nearest Pattern",
description = "Delete the nearest and highest-priority formatted structure around the cursor",
key = "Alt-d",
run = function()
local match = findNearestInlinePattern()
if not match then
editor.flashNotification("No pattern matched.")
return
end
local sel = { from = match.start - 1, to = match.stop }
editor.replaceRange(sel.from, sel.to, "")
editor.flashNotification(match.name .. ": removed ✅")
if not match.name == "Inline Code" then
editor.flashNotification(match.text)
end
end
}