I'm using the plugin vim-surround, which maps ds( to "delete surrounding brackets", e.g. turns (Hello) into Hello. I want to map a command to delete a function appliction, e.g. turning foo(bar) into bar.
I tried
nmap <Leader>df bdt(ds(
to go to the beginning of the word, delete up to the first (, and then delete the surrounding parentheses. However, when I use it, it only deletes up to the bracket, and doesn't do the subsequent deletion of the brackets themselves. I've tried putting other editing commands after the initial part, and that works. So
nmap <Leader>df bdt(x
works as expected.
Similarly, I tried just doing
nmap <Leader>s ds(
and that also works!
Other things that don't work:
nmap <Leader>df bdt(<bar>ds(
Does anyone know how I can make this work?
I would suggest a simpler mapping like the following.
nmap <silent> dsf ds)db
This will delete the "surrounding" function application so the cursor needs to be on or inside the parens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With