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

73457Re: Patch: formatoptions in ftplugins

Expand Messages
  • glts
    Sep 30, 2013
    • 0 Attachment
      On Mon, Sep 30, 2013 at 9:57 AM, David Barnett <daviebdawg@...> wrote:
      > I've found the built-in ftplugin files are all over the place with respect to handling 'formatoptions'. Some ftplugins don't touch it, many clobber useful user preferences. I put together a patch that batch-changes the ftplugin files to stop clobbering anything that might be a user preference.
      >
      > Rationale: Most 'formatoptions' options affect interactive editing behavior that vim shouldn't manage per-filetype, and doesn't currently manage consistently.
      >
      > The 't' option in particular seems like it could vary by filetype: it does insane things for almost every filetype just blindly jamming in newlines at a certain width, and should be forced disabled in most cases. But for the text filetype or unspecified filetype, it makes perfect sense. I think maybe it should never be explicitly enabled but should be explicitly disabled for most filetypes.
      >
      > The 'o' and 'r' options determine whether to automatically insert the comment leader when starting a new line after a comment line. I want +o -r everywhere, but most ftplugin files force +croql, so I have to fight with them by creating after/ files to force -r again. These weren't per-filetype settings and should have been left alone. Same for 'l'.
      >
      > The 'c' option also seems like it never needs to vary by filetype because comments are a specific case and there's no per-filetype reason you would want to auto-wrap comments.
      >
      > Then there are some I'm not sure about. I don't understand the value of ever disabling 'q', the option to 'Allow formatting of comments with "gq"'. And 'm1' is set for certain filetypes like verilog… I don't follow if that's because of something specific to verilog syntax, or if it's just the authors' preferred configuration.

      I support this initiative. A bulk patch won't be accepted though.

      The line

      setlocal formatoptions-=t formatoptions+=croql

      has become boilerplate for ftplugins, but unlike settings such as
      'commentstring' or 'matchpairs' or whathaveyou, these are not settings
      that pertain to the domain of the *file type*. They're user settings.
      (By the way, see the comment in ftplugin/clojure.vim for a similar
      sentiment!)

      If there is an agreement that the "+=croql" setting doesn't really
      belong in a core ftplugin, I'll remove it from the one I maintain.
      Hopefully others feel the same way: please speak up.

      Best,

      --
      --
      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