user5775230
user5775230

Reputation:

How to use Vim surround to surround paragraph on current beginning and ending lines of the paragraph?

I'm using tpope's surround.vim. Example:

Apply ysip] to

[1 0]
[0 1]

will yield

[
 [1 0]
 [0 1]
 ]

Instead, I'd like to the output to look like

[[1 0]
 [0 1]]

I have also tried this surround with all the visual mode variants I can think of (i.e. vip], VjS], etc.)

and am still having no luck. I'm new to text objects and plugin customizing, and just thought I'd ask of any quick solutions before I try editing the surround file.

Edit: I also found {jv}k$hS] was the general solution for what I needed as a remapping!

Upvotes: 3

Views: 964

Answers (1)

romainl
romainl

Reputation: 196566

AFAIK, the only way to obtain what you want is to select your text in visual mode (not visual-line or visual-block):

v$jS]

Upvotes: 6

Related Questions