【问题标题】:Standard ML comment formatting is faulty in vimvim 中的标准 ML 注释格式错误
【发布时间】:2015-10-01 17:57:37
【问题描述】:

我已经尝试了以下命令来格式化~/.vim/after/indent/sml.vim中的cmets

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

等等各种组合。我似乎无法实现中间注释行缩进 1 个空格的 C 样式注释。而不是这个

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

我明白了

(*
* Some misaligned text
* etc. *)

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

【问题讨论】:

    标签: vim comments sml


    【解决方案1】:

    当我使用这些设置时,

    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 并按 Enter,
    • 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 pkg-vim-maintainers@lists.alioth.debian.org
    Compiled by buildd@
    Huge version without GUI.  Features included (+) or not (-):
    ...
    

    也许您有一些其他设置或插件会影响此行为。

    【讨论】:

    • 我尝试禁用我的所有插件并使用一个简单的最小配置:set nocompatible filetype plugin indent on syntax enable 并得到相同的结果。这是 Windows 上的 (g)Vim,版本 7.4。
    猜你喜欢
    • 2011-01-03
    • 1970-01-01
    • 2012-09-21
    • 2010-10-21
    • 2020-05-31
    • 1970-01-01
    • 2011-11-12
    • 2014-05-28
    • 1970-01-01
    相关资源
    最近更新 更多