开发者

Vim: wrap text (ie, "gq") without breaking strings?

开发者 https://www.devze.com 2022-12-12 04:01 出处:网络
I often use gq to wrap code… But it isn\'t very smart when it comes to strings. For example, wrapping:

I often use gq to wrap code… But it isn't very smart when it comes to strings. For example, wrapping:

foo = bar("a b c d e f")

Might result in:

foo = bar("a b c
          d e f")

Which, obviously, isn't nearly as useful as:

foo = bar("a b c " +
          "d e f")

would b开发者_Go百科e.

Is there any way to wrap text which takes this into account?


I am not aware of a way to make gq do this out of the box, but the solution I have used is to write a custom function and map, in my case gqc, to it.

Something akin to this

0

精彩评论

暂无评论...
验证码 换一张
取 消