作者stevenlin08 (stevens)
看板Editor
标题[vim ] 搜寻字串取代成具有空白字元的字串
时间Tue Oct 22 21:21:06 2013
请问大家
如何将各Arithmetic operators 算术运算子及逻辑运算子
的前後加上空格.
像是
a=b;
应为
a = b;
而对於逻辑运算子也应该用上.
不知大家都是如何去处理的?
目前都是写完後再用搜寻取代方式(:%s/=/ = /gc)
但这样做跟一行一行检查一样,而且不方便.
我想这部份可能需要用Regexp 常规表示式.
对於这个Regexp如何表示?
(+,-,*,/,+=,-=,/=,*= and ==,!=,<,>,...)
并避开一些command用的(//,/****,*/)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.126.34.194
※ 编辑: stevenlin08 来自: 59.126.34.194 (10/22 21:22)
1F:推 fjm31714:try astyle --pad-oper ? 10/22 21:49
2F:→ stevenlin08:太感谢了,,没错,我就是想用这个 10/23 00:46
3F:→ stevenlin08:Cannot convert to multi-byte string, reverting to 10/23 00:47
4F:→ stevenlin08:to English...不知是我的有问题,它会出现这个. 10/23 00:48
6F:→ stevenlin08:我是直接download astyle後,把bin file放在vim的同一 10/23 00:51
7F:→ stevenlin08:目录中, 10/23 00:51
8F:→ jokester:可惜astyle不能处理c系以外的语言.. 11/01 14:17