xiancode / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

Handle the offset for the end of a three-piece comment ignored #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
:help format-comments mentions that it is possible to specify an offset for the 
end of a three-piece comment:

  {digits}
    When together with 's' or 'e': add {digit} amount of offset to an
    automatically inserted middle or end comment leader. The offset begins
    from a left alignment. See below for more details.

  -{digits}
    Like {digits} but reduce the indent.  This only works when there is
    some indent for the start or end part that can be removed.

This seems to have never been implemented. If you are interested in 
implementing the feature, I made a small first step: I modified insertchar() in 
edit.c so that the closing part is correctly indented (with the offset) when 
the auto-close comment functionality is triggered but:
• my solution uses spaces – it does not take into account the value of
  'et', 'ts', etc.,
• get_c_indent() does not handle the offset setting.

If you decide to implement this, at least the settings mentioned above will 
have to be considered (perhaps other as well).

You might have a look at the attached patch (against Vim 7.3.189) if you'd like 
a pointer to where to start. Also have a look at open_line().

Original issue reported on code.google.com by lech.lor...@gmail.com on 15 May 2011 at 10:34

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by chrisbr...@googlemail.com on 9 Jan 2015 at 12:09