Vim different textwidth for multiline C comments?
问题 In our C++ code base we keep 99 column lines but 79-some-odd column multiline comments. Is there a good strategy to do this automagically? I assume the modes are already known because of smart comment line-joining and leading * insertion. 回答1: Apparently both code and comments use the same textwidth option. As far as I can see, the only trick is to set this option dynamically: :autocmd CursorMoved,CursorMovedI * :if match(getline(.), '^\s*\*') == 0 | :setlocal textwidth=79 | :else | :setlocal