Remove enclosed braces

I have this text:

Monkeys eat {bananas}.

My cursor is in the middle of the word banana:

Monkeys eat {bana|nas}.

The symbol |indicates the cursor position.

How can I remove curly braces?

I can change bananas to apples simple ci}apples, maybe I could use a similar trick to get rid of the characters {and }?

Can I do this even in this case, which is actually what I really need to do ...

networks {
    local
    is|p
}

The simplified example given above was only to introduce the concept ...

+5
source share
4 answers

Vim. , :

di{v%p
+8

surround.vim ( ), d s { {

, , , surround.vim , XML/HTML , , " , ".

+7

:

yiBvaBp

.

+4

?

mz[{x]}x`z

:help m- set a mark. In this case, mark the start position of the cursor so that I can return there at the end. :help [{- moves the cursor to the opening bracket of the smallest block enclosed in the cursor. :help x- delete the bracket that is now under the cursor. ]}and x- do the same with the closing bracket. And finally

help `

returning to the marked position created at the beginning of the created z.

"Plugins" is not my style ...

+1
source

All Articles