Skip to content

Need help trying to define a custom surround (deletion) #121

Answered by kylechui
smjonas asked this question in Q&A
Discussion options

You must be logged in to vote

Here you're going to want to use find = "%*%*?.-%*%*?". This is because the text-object a* does not exist (unless it is defined by another plugin, e.g. targets.vim). The idea is that the textobject key should only really be used for built-in text-objects or for characters for which there exists a defined text-object, e.g. T key uses t for finding the parent selection. I'll look into improving the docs; the find key can be omitted but it defaults to invalid_key_behavior's find key, which just looks for a surrounding pair of the character you inputted.

In general, the process is:

  • The find key finds a "parent" selection that includes the surrounding pair
    • If omitted, nvim-surround will fall…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@kylechui
Comment options

@kylechui
Comment options

@smjonas
Comment options

@kylechui
Comment options

@kylechui
Comment options

Answer selected by smjonas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants