Loading ...
Sorry, an error occurred while loading the content.

73505Re: Patch: formatoptions in ftplugins

Expand Messages
  • Bram Moolenaar
    Oct 5, 2013
    • 0 Attachment
      David B├╝rgin wrote:

      > On Wed, Oct 2, 2013 at 12:52 PM, Bram Moolenaar <Bram@...> wrote:
      > >
      > > David Barnett wrote:
      > >
      > >> +Nikolai +Bram +Tim (authors of the majority of these plugins)
      > >>
      > >> I'm confident we can get consensus to at least remove a few of those
      > >> formatoptions modifications. You should also add "setlocal
      > >> formatoptions-=3Dt" in pretty much every case (unless your syntax is fine
      > >> with any arbitrary space being converted to a newline). ftplugin/python.vim
      > >> should be setting -t, for instance.
      > >>
      > >> FYI, these settings affect what happens when you set &textwidth to
      > >> non-zero, so the problem usually only comes up when users want to set
      > >> &textwidth and use &colorcolumn.
      > >
      > > I think we should make a difference between the case the user has not
      > > set any formatting options and when he did. If there are no user
      > > preferences, the user expects the filetype plugin to do it all. If the
      > > user did set preferences, we should indeed avoid overruling these when
      > > they are not specific for the filetype.
      > >
      > > Once we agree, an explanation needs to be added to :help
      > > write-filetype-plugin
      > yes, that's a fair solution.
      > However -- what worries me is that this requires even more boilerplate
      > in all ftplugins. I understand your point about not changing what the
      > user is used to, but I don't feel this way is a step forward really.
      > What we could do to mitigate the impact on the users is make the setting
      > "formatoptions+=croql" recommended boilerplate for everybody's vimrc:
      > diff -r 20068068e3f9 runtime/vimrc_example.vim
      > --- a/runtime/vimrc_example.vim Wed Oct 02 18:43:06 2013 +0200
      > +++ b/runtime/vimrc_example.vim Wed Oct 02 20:38:15 2013 +0200
      > @@ -31,6 +31,9 @@
      > set showcmd " display incomplete commands
      > set incsearch " do incremental searching
      > +" Fine-tune how Vim formats comments and long lines. See ":help fo-table".
      > +set formatoptions+=croql
      > +
      > " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
      > " let &guioptions = substitute(&guioptions, "t", "", "g")
      > That way we could implement the change and just guide users to the new
      > (and better) practice. What do you think about this solution? I'd love
      > to see it happen.

      I think it is a good idea to keep vimrc_example.vim as short as
      possible. It only contains things that "everybody should use".

      The default value for 'formatoptions' is "tcq". You propose to add
      "rol" here. "r" and "o" are for adding the comment leader, "l" for not
      breaking lines that were already longer than 'textwidth'. I don't
      consider these helpful enough to set by default.

      The "l" flag has limited effect, when typing a string literal that
      crosses "textwidth" it still gets broken.

      "r" and "o" are typically for when a file type has comments and depends
      on what kind of comments could be wrapped properly.

      Proverb: A nightingale that forgets the lyrics is a hummingbird.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 14 messages in this topic