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

questions about formatoptions on Ubuntu 10.04 vim

Expand Messages
  • allstars
    hi i found in ubuntu 10.04 vim the comment leader wont be inserted automatically when i type it seems i have to add an extra line set formatoptions=ro
    Message 1 of 5 , Jun 20 8:27 PM
      hi
      i found in ubuntu 10.04 vim
      the comment leader wont be inserted automatically
      when i type <Enter>

      it seems i have to add an extra line
      set formatoptions=ro
      in my vim.rc

      am i correct about this?
      does anyone know why i need to add this line additionally?
      before 10.04 i didnt have to add this options

      thanks

      --
      You received this message from the "vim_use" 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
    • Tony Mechelynck
      ... 1) The formatoptions is an option whioch is often modified by filetype-plugins; it may depend of the filetype of the file you re currently editing. If
      Message 2 of 5 , Jun 21 8:23 AM
        On 21/06/10 05:27, allstars wrote:
        > hi
        > i found in ubuntu 10.04 vim
        > the comment leader wont be inserted automatically
        > when i type<Enter>
        >
        > it seems i have to add an extra line
        > set formatoptions=ro
        > in my vim.rc
        >
        > am i correct about this?
        > does anyone know why i need to add this line additionally?
        > before 10.04 i didnt have to add this options
        >
        > thanks
        >

        1) The 'formatoptions' is an option whioch is often modified by
        filetype-plugins; it may depend of the 'filetype' of the file you're
        currently editing. If it bothers you you may add an after-ftplugin in
        ~/.vim/after/ftplugin/whatever.vim, replacing "whatever" by the
        filetype. DO NOT modify-in-place anything in or under $VIMRUNTIME at any
        depth because any runtime files update may (and sooner or later an
        update is bound to) remove your changes with no warning.

        2) Some Linux distributions (misguidedly IMO) add a "system vimrc" which
        is sourced before your .vimrc and can modify Vim defaults (for instance,
        the SuSE system vimrc disables modelines "for security reasons" (sic)).
        The location of that system vimrc can be modified at compile-time; it is
        listed near the middle of the output of the ":version" command. If this
        is the case, I think the correct way to counteract it is in your vimrc
        (after all, if they did it once, they can do it again, e.g. at the next
        system upgrade).

        Another possibility against (2) is to compile your own Vim, which will
        install (by default) under /usr/local (with $VIMRUNTIME at
        /usr/local/share/vim/vim72/ or /usr/local/share/vim/vim73a/ for the
        current "stable" and "development" versions respectively), and will look
        for its system vimrc at $VIM/vimrc while most distributions place it as
        /etc/vimrc.


        Best regards,
        Tony.
        --
        Be free and open and breezy! Enjoy! Things won't get any better so
        get used to it.

        --
        You received this message from the "vim_use" 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
      • Gary Johnson
        ... The default value of formatoptions does not include either r or o , so it could be that Ubuntu used to set that option somehow and now does not. The
        Message 3 of 5 , Jun 21 10:41 AM
          On 2010-06-20, allstars wrote:
          > hi
          > i found in ubuntu 10.04 vim
          > the comment leader wont be inserted automatically
          > when i type <Enter>
          >
          > it seems i have to add an extra line
          > set formatoptions=ro
          > in my vim.rc
          >
          > am i correct about this?
          > does anyone know why i need to add this line additionally?
          > before 10.04 i didnt have to add this options

          The default value of 'formatoptions' does not include either 'r' or
          'o', so it could be that Ubuntu used to set that option somehow and
          now does not. The 'formatoptions' option is often set by filetype
          plugins, so it could also be that filetype detection has changed
          with this version of Ubuntu. Does filetype detection appear to work
          the same as before? Having a problem with the comment leader
          suggests that you editing source code. The 'filetype' setting
          should correspond to the programming language you're using. Do you
          get the expected result from

          :set ft?

          If you want to see where 'formatoptions' was last set, execute

          :verbose set formatoptions?

          HTH,
          Gary

          --
          You received this message from the "vim_use" 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
        • allstars
          thanks Gary now i try to narrow down my problem so far so filetype is just C and :set filetype? it returns c but i have checked
          Message 4 of 5 , Jun 21 8:34 PM
            thanks Gary
            now i try to narrow down my problem

            so far so filetype is just C
            and :set filetype? it returns c

            but i have checked /usr/share/vim/vim72/ftplugin/c.vim
            it has
            setlocal fo-=t fo+=croql

            i have also checked /usr/share/vim/vim72/filetype.vim
            au BufNewFile,BufRead *.c call s:FTlpc()
            in FTlpc i think it sets filetype to c correctly

            so far i think the problem is caused by not loading c.vim correctly

            do u have any idea?

            thanks

            On Jun 22, 1:41 am, Gary Johnson <garyj...@...> wrote:
            > On 2010-06-20, allstars wrote:
            > > hi
            > > i found in ubuntu 10.04 vim
            > > the comment leader wont be inserted automatically
            > > when i type <Enter>
            >
            > > it seems i have to add an extra line
            > > set formatoptions=ro
            > > in my vim.rc
            >
            > > am i correct about this?
            > > does anyone know why i need to add this line additionally?
            > > before 10.04 i didnt have to add this options
            >
            > The default value of 'formatoptions' does not include either 'r' or
            > 'o', so it could be that Ubuntu used to set that option somehow and
            > now does not.  The 'formatoptions' option is often set by filetype
            > plugins, so it could also be that filetype detection has changed
            > with this version of Ubuntu.  Does filetype detection appear to work
            > the same as before?  Having a problem with the comment leader
            > suggests that you editing source code.  The 'filetype' setting
            > should correspond to the programming language you're using.  Do you
            > get the expected result from
            >
            >     :set ft?
            >
            > If you want to see where 'formatoptions' was last set, execute
            >
            >     :verbose set formatoptions?
            >
            > HTH,
            > Gary

            --
            You received this message from the "vim_use" 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
          • allstars
            after using -V and -D options in Vim finally i found i only have to uncomment the following lines in my / etc/vim/vimrc if has( autocmd ) filetype plugin
            Message 5 of 5 , Jun 21 9:42 PM
              after using -V and -D options in Vim
              finally i found i only have to uncomment the following lines in my /
              etc/vim/vimrc

              "if has("autocmd")
              " filetype plugin indent on
              "endif

              thanks for your tips anyway!



              On Jun 22, 11:34 am, allstars <allstars....@...> wrote:
              > thanks Gary
              > now i try to narrow down my problem
              >
              > so far so filetype is just C
              > and :set filetype?  it returns c
              >
              > but i have checked /usr/share/vim/vim72/ftplugin/c.vim
              > it has
              > setlocal fo-=t fo+=croql
              >
              > i have also checked /usr/share/vim/vim72/filetype.vim
              > au BufNewFile,BufRead *.c                       call s:FTlpc()
              > in FTlpc i think it sets filetype to c correctly
              >
              > so far i think the problem is caused by not loading c.vim correctly
              >
              > do u have any idea?
              >
              > thanks
              >
              > On Jun 22, 1:41 am, Gary Johnson <garyj...@...> wrote:
              >
              >
              >
              > > On 2010-06-20, allstars wrote:
              > > > hi
              > > > i found in ubuntu 10.04 vim
              > > > the comment leader wont be inserted automatically
              > > > when i type <Enter>
              >
              > > > it seems i have to add an extra line
              > > > set formatoptions=ro
              > > > in my vim.rc
              >
              > > > am i correct about this?
              > > > does anyone know why i need to add this line additionally?
              > > > before 10.04 i didnt have to add this options
              >
              > > The default value of 'formatoptions' does not include either 'r' or
              > > 'o', so it could be that Ubuntu used to set that option somehow and
              > > now does not.  The 'formatoptions' option is often set by filetype
              > > plugins, so it could also be that filetype detection has changed
              > > with this version of Ubuntu.  Does filetype detection appear to work
              > > the same as before?  Having a problem with the comment leader
              > > suggests that you editing source code.  The 'filetype' setting
              > > should correspond to the programming language you're using.  Do you
              > > get the expected result from
              >
              > >     :set ft?
              >
              > > If you want to see where 'formatoptions' was last set, execute
              >
              > >     :verbose set formatoptions?
              >
              > > HTH,
              > > Gary

              --
              You received this message from the "vim_use" 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
            Your message has been successfully submitted and would be delivered to recipients shortly.