简体   繁体   English

Vim:将匹配的括号转换为匹配的花括号

[英]Vim: converting matching parenthesis to matching curly braces

I saw a screencast where someone had highlighted a set of parenthesis and instantly converted them to curly braces. 我看到一个截屏视频,其中有人突出显示了一组括号并立即将其转换为花括号。 Is this a macro or a Vim thing? 这是宏还是Vim?

you can do it with surround.vim plugin. 您可以使用Surround.vim插件来实现。 https://github.com/tpope/vim-surround https://github.com/tpope/vim-surround

eg 例如

when your cursor ( * ) at : ( fo*o) , press cs({ will change your text into { fo*o} 当光标( * )位于: ( fo*o) ,按cs({会将您的文本更改为{ fo*o}

They use vim surround plugin . 他们使用vim Surround 插件

Quoting their Hello World. 引用他们的Hello World。

It's easiest to explain with examples. 用示例最容易解释。 Press cs"' inside 在里面按cs"'

"Hello world!" “你好,世界!”

to change it to 更改为

'Hello world!' '你好,世界!'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM