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

71348Re: set textwidth=80 and c mode

Expand Messages
  • A.J.Mechelynck
    Jul 15, 2006
      Paul Drynoff wrote:
      > Hello.
      > I for long time used vim with mutt,
      > like this:
      > set editor="vim +':set textwidth=60' %s"
      > at now I need the same functionality for "C" files.
      > but all looks like that textwidth is ignoring by vim, when "C mode" is on.
      > may be there is similar option, but for "C mode"?

      In C code, reformatting normally happens only within comments, because
      auto-reformatting long statements or conditions (breaking lines in them)
      could be awkward, and even in some cases it could, IIUC, introduce
      syntax errors. It could certainly make the code less readable by
      breaking lines at places not reflecting its "logic". See

      :help 'formatoptions'
      :help fo-table

      BTW (and after reading some more of this thread), I recommend adding

      runtime vimrc_example.vim

      at the top of your vimrc. That script sets lots of useful settings. If
      it does sompething you don't like, you can always override it later in
      your vimrc.

      Best regards,
    • Show all 9 messages in this topic