diff --git a/README.md b/README.md index 8fa2798..9a1ec65 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Bundle of more than 30 new textobjects for Neovim. | `visibleInWindow` | all lines visible in the current window | \- | \- | `gw` | all | | `restOfWindow` | from the cursorline to the last line in the window | \- | \- | `gW` | all | | `lastChange` | Last non-deletion-change, yank, or paste.[^2] | \- | \- | `g;` | all | -| `mdlink` | markdown link like `[title](url)` | inner is only the link title (between the `[]`) | small | `il`/`al` | markdown, toml | +| `mdLink` | markdown link like `[title](url)` | inner is only the link title (between the `[]`) | small | `il`/`al` | markdown, toml | | `mdEmphasis` | markdown text enclosed by `*`, `**`, `_`, `__`, `~~`, or `==` | inner is only the emphasis content | small | `ie`/`ae` | markdown | | `mdFencedCodeBlock` | markdown fenced code (enclosed by three backticks) | outer includes the enclosing backticks | big | `iC`/`aC` | markdown | | `cssSelector` | class in CSS like `.my-class` | outer includes trailing comma and space | small | `ic`/`ac` | css, scss | diff --git a/lua/various-textobjs/default-keymaps.lua b/lua/various-textobjs/default-keymaps.lua index f847804..bf3ac68 100644 --- a/lua/various-textobjs/default-keymaps.lua +++ b/lua/various-textobjs/default-keymaps.lua @@ -29,7 +29,7 @@ local oneMaps = { lastChange = "g;", -- consistent with g; movement } local ftMaps = { - { map = { mdlink = "l" }, fts = { "markdown", "toml" } }, + { map = { mdLink = "l" }, fts = { "markdown", "toml" } }, { map = { mdEmphasis = "e" }, fts = { "markdown" } }, { map = { pyTripleQuotes = "y" }, fts = { "python" } }, { map = { mdFencedCodeBlock = "C" }, fts = { "markdown" } }, diff --git a/lua/various-textobjs/textobjs/charwise.lua b/lua/various-textobjs/textobjs/charwise.lua index 75768bd..98d2de4 100644 --- a/lua/various-textobjs/textobjs/charwise.lua +++ b/lua/various-textobjs/textobjs/charwise.lua @@ -27,7 +27,7 @@ local function selectFromCursorTo(endPos, notFoundMsg) end -------------------------------------------------------------------------------- --- INFO The following function are exposed for creation of custom textobjs, but +-- INFO The following functions are exposed for creation of custom textobjs, but -- subject to change without notice. ---Seek and select characterwise a text object based on one pattern. @@ -261,7 +261,7 @@ function M.nearEoL() selectFromCursorTo({ row, endCol }, config.forwardLooking.small) end ----current line (but characterwise) +---current line, but characterwise ---@param scope "inner"|"outer" outer includes indentation and trailing spaces function M.lineCharacterwise(scope) -- FIX being on NUL, see #108 and #109 @@ -389,11 +389,16 @@ end -- FILETYPE SPECIFIC TEXTOBJS ---@param scope "inner"|"outer" inner link only includes the link title, outer link includes link, url, and the four brackets. -function M.mdlink(scope) +function M.mdLink(scope) local pattern = "(%[)[^%]]-(%]%b())" M.selectClosestTextobj(pattern, scope, config.forwardLooking.small) end +-- DEPRECATION (2024-12-04), changed for consistency with other objects +function M.mdlink() + u.warn("`.mdlink()` is deprecated. Use `.mdLink()` instead (uses capital L).") +end + ---@param scope "inner"|"outer" inner selector only includes the content, outer selector includes the type. function M.mdEmphasis(scope) -- CAVEAT this still has a few edge cases with escaped markup, will need a