2015-07-13 54 views
2

错误我在~/.vim/after/indent/sml.vim标准ML注释的格式是VIM

set comments=s1:(*,mb:*,ex:*) 
set comments=sr:(*,mb:*,ex:*) 
set comments=s1:(*,mb:\ *,ex:*) 
set comments=sr:(*,mb:*,ex:*) 

与各种组合尝试下面的命令格式化的意见等。我似乎无法实现C风格的评论,其中中间评论行缩进了1个空格。取而代之的是

(* Text 
* More text 
* even more text *) 

我得到这个

(* 
* Some misaligned text 
* etc. *) 

有什么建议? :h format-options comments fo-table不建议任何看起来有用的替代方案。

回答

0

当我使用这些设置,

set comments=s1:(*,mb:*,ex:*) 
set comments=sr:(*,mb:*,ex:*) 
set comments=s1:(*,mb:\ *,ex:*) 
set comments=sr:(*,mb:*,ex:*) 

我得到下面的结果,

(* blah blah blah blah blah adsf blah blah blah blah blah blah blah blah 
* blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
* blah blah blah blah blah blah ... 

这个工作无论我

  • set formatoptions+=tset textwidth=80并超过行,
  • set formatoptions+=r并按下回车键,
  • set formatoptions+=o并在命令模式下打到o/O,或
  • set formatoptions+=q,打gq

在我的〜/ .vimrc au Filetype sml source ~/.vim/after/indent/sml.vim

这是在Ubuntu 15.04的默认Vim的:

:version 
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:32) 
Included patches: 1-52 
Modified by [email protected] 
Compiled by [email protected] 
Huge version without GUI. Features included (+) or not (-): 
... 

也许你有一个影响这种行为其他一些设置或插件。

+0

我试图禁用我的所有插件和使用裸配置的最小值: '设置nocompatible 类型插件缩进上 语法enable' 并得到了相同result.This是(G)的Vim在Windows,版本7.4。 – neoDaedalus