Replies: 4 comments 8 replies
-
I'm interested in the |
Beta Was this translation helpful? Give feedback.
-
I don't see any use case for Putting aside the question of implementation and whether it's worth the complexity, |
Beta Was this translation helpful? Give feedback.
-
One other thing I was thinking related to cursor_position was the ability to set a custom cursor position after the surround. One example I thought of recently was in the case markdown or other similar markup languages if you have a custom surround to insert a link such as: ["l"] = { -- for link
add = { "()[", "]" },
} And want the cursor to end up in the parenthesis, ex. Thoughts on this? |
Beta Was this translation helpful? Give feedback.
-
this would be nice for cases like emmet abbreviation, in which case we'd like to jump to completion stops t = {
add = add_function_for_emmet_abbreviation,
---@type 'begin'|'sticky'|(function(): nil|'begin'|'sticky')
move_cursor = function()
-- function which either
-- 1. moves the cursor for you
-- 2. returns a (string) move cursor type
-- 3. returns nil, thus falling back to globally configured behaviour
end, |
Beta Was this translation helpful? Give feedback.
-
I'm thinking of adding
"sticky"
to themove_cursor
functionality in #334; if anybody has ideas/suggestions/objections they would like to share, feel free to do so here.The current functionality only really supports
"begin"
andfalse
, which move the cursor to the beginning of the selection and keep the cursor stationary, respectively. The idea is that"sticky"
keeps the cursor "stuck" to whatever character the cursor was on before the surround action. See the unit tests in #334 for an idea of how exactly this would work.One nice use case for this is dot-repeating with a sticky cursor, as one can do ysiw]. to surround a word with double brackets, whereas the old behavior would do something like hello → [[]hello] (since the dot-repeat would surround the open square bracket).
Please react to show interest in this feature!
EDIT: Functionality seems pretty complete in #334; might merge it soon-ish 🤔
Beta Was this translation helpful? Give feedback.
All reactions