特别是在编辑旧版 C++ 代码时,我经常发现自己手动重新格式化如下内容:
SomeObject doSomething(firstType argumentOne, secondType argumentTwo, thirdType argumentThree);
像这样的事情:
SomeObject doSomething(firstType argumentOne,
secondType argumentTwo,
thirdType argumentThree);
有内置命令可以执行此操作吗?如果没有,有人可以建议一个插件或提供一些 VimScript 代码吗? (J
or gq
可以很容易地逆转该过程,因此不需要双向进行。)
您可以使用分割连接 https://github.com/AndrewRadev/splitjoin.vim.
SomeObject doSomething(firstType argumentOne, secondType argumentTwo, thirdType argumentThree);
在括号内或括号内键入gS
分开。你得到:
SomeObject doSomething(firstType argumentOne,
secondType argumentTwo,
thirdType argumentThree);
您还可以使用vim argwrap https://github.com/FooSoft/vim-argwrap/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)