VS代码:重新包装文本块或注释

时间:2017-03-20 19:12:12

标签: visual-studio-code

如何重新包装文本块或长注释以适合80列?

我不希望它只是渲染自动换行(这可以通过编辑 - >切换自动换行或设置"editor.wordWrap": "on"轻松实现),但我希望它实际上插入硬线断裂。此功能在某些编辑器中称为“填充段落”。

例如:

// This is a very long comment. I would like for this comment to occupy multiple lines rather than a single line, so that it is easy to read for other people.

现在我想按一些键来获取:

// This is a very long comment. I would like for this comment to occupy
// multiple lines rather than a single line, so that it is easy to read for
// other people.

2 个答案:

答案 0 :(得分:2)

看起来这个插件可以满足您的需求。不确定是否还有原生方式。他们仍然添加了很多功能。

https://marketplace.visualstudio.com/items?itemName=stkb.rewrap

答案 1 :(得分:1)

VSCodeVim支持此功能。只需选择一个文本块,然后按gq即可。 :)