Closed maxigaz closed 1 year ago
:h nvim-surround
v0.8.3
Tagged (Stable)
vim.cmd([[let $PLUGIN_DIRECTORY = '~/.local/share/nvim/plugtest']]) vim.cmd([[packadd nvim-surround]]) require("nvim-surround").setup({ surrounds = { -- strong emphasis for markdown ["s"] = { add = { "**", "**" }, find = "%*%*.-%*%*", delete = "^(%*%*?)().-(%*%*?)()$", change = { target = "^(%*%*?)().-(%*%*?)()$", }, }, }, })
This is a test sentence with **emphasis**. Another one (for good measure).
dss
When the cursor is on **emphasis**, pressing the keystroke above deletes the surrounding asterisks, leaving emphasis. as a result.
**emphasis**
emphasis
The parentheses in the second paragraph are deleted, leaving Another one for good measure. as a result.
Another one for good measure.
I adapted the example in this comment, where I changed the trigger key from * to s.
*
s
If I change it back to * or replace it with another letter such as e, it works without any issues.
e
Have you tried setting the alias s to false in the setup function? By default, s is an alias that matches "any built-in surround".
false
I've only tried that just now. It solves the problem. Thank you!
Checklist
:h nvim-surround
to see if there might be any relevant information there?Neovim Version
v0.8.3
Plugin Version
Tagged (Stable)
Minimal Configuration
Sample Buffer
Keystroke Sequence
dss
Expected behavior
When the cursor is on
**emphasis**
, pressing the keystroke above deletes the surrounding asterisks, leavingemphasis
. as a result.Actual behavior
The parentheses in the second paragraph are deleted, leaving
Another one for good measure.
as a result.Additional context
I adapted the example in this comment, where I changed the trigger key from
*
tos
.If I change it back to
*
or replace it with another letter such ase
, it works without any issues.