作者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