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

Re: How to get Allman style while typing and templated C++ code in Vim 7.3

Expand Messages
  • Reid Thompson
    ... forgot the vim.org page http://www.vim.org/scripts/script.php?script_id=213 -- If you have received the message in error, please advise the sender by reply
    Message 1 of 12 , May 23, 2013
    • 0 Attachment
      On Thu, 2013-05-23 at 14:44 +0000, Reid Thompson wrote:
      > On Thu, 2013-05-23 at 00:59 -0700, arjicot@... wrote:
      > >
      > > thanks, that documentation looks oddly paginated and not that easy to read, there is an rst version or a pdf one ? There is a more specific C++ plugin maybe with C++11 support ? I don't care about C.
      > it supports both c and c++
      >
      > http://www.vim.org/scripts/script.php?script_id=213 --> The key mappings of this plugin (PDF) : http://lug.fh-swf.de/vim/vim-c/c-hotkeys.pdf
      >
      > The help file online : http://lug.fh-swf.de/vim/vim-c/csupport.html

      forgot the vim.org page
      http://www.vim.org/scripts/script.php?script_id=213


      --
      If you have received the message in error, please advise the sender by
      reply email and please delete the message. This message contains
      information which may be confidential or otherwise protected. Unless
      you are the addressee (or authorized to receive for the addressee), you
      may not use, copy, or disclose to anyone the message or any information
      contained in the message.


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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Gary Johnson
      ... The formatprg option does not do automatic formatting unless the a flag of formatoptions is set, which I would not recommend in this case. Further,
      Message 2 of 12 , May 23, 2013
      • 0 Attachment
        On 2013-05-23, arjicot wrote:
        > Il giorno mercoledì 22 maggio 2013 20:01:12 UTC+2, Ben Fritz ha scritto:
        > > On Wednesday, May 22, 2013 10:43:48 AM UTC-5, arjicot wrote:
        > > > Hi guys, my first post here and this is my 3rd day with vim.
        > > >
        > >
        > > Welcome!
        > >
        > > >
        > > > I'm used to astyle ( http://astyle.sourceforge.net/ ) and I
        > > > like the Allman style and I would love the ability to get some
        > > > smart formatting while typing C++ code
        > >
        > > It looks from the description of astyle, that you should just be
        > > able to use astyle still, automatically as you type in Vim.
        > >
        > > See :help 'formatprg' and :help 'formatoptions'.
        > >
        > > > My actual .vimrc is this one
        > > > ...
        > > > syntax on
        > > > ...
        > > > set autoindent smartindent " auto/smart indent
        > > > ...
        > > > set autoindent
        > > > set cindent
        > >
        > > You have autoindent turned on twice, and smartindent (which I
        > > would recommend NOT using, it's not smart at all), and also
        > > cindent. cindent will override all the previous ones.
        > >
        > > Additionally, normally you don't turn cindent on in your .vimrc.
        > >
        > > Instead, right before your "syntax on" command, put:
        > >
        > > filetype indent on
        > >
        > > or
        > >
        > > filetype plugin indent on
        > >
        > > This will turn on Vim's smart filetype-based indenting.
        > >
        > > If you want to use astyle you may not want to put the "indent"
        > > in there however, or you could override it for C/C++ code using
        > > the "after" directory (:help after-directory).
        >
        > Now i have
        >
        > ############################################

        > autocmd FileType cpp set formatprg=astyle\ -s2pPA1

        > ############################################
        >
        > but I got nothing out of this formatpgr, it's like nothing
        > changed, not even with gg=G, I don't know where to look anymore,
        > vim still uses the old formatting tool, it's supposed to be ok as
        > far as I know.

        The 'formatprg' option does not do automatic formatting unless the
        'a' flag of 'formatoptions' is set, which I would not recommend in
        this case. Further, the = command uses 'equalprg', not 'formatprg'.

        So, to format your code using astyle as the 'formatprg', you will
        need to manually reformat sections as you go with gq, not =.

        Alternatively, you could set 'equalprg' to astyle, then use the =
        command.

        I think the behavior may be different between using astyle as the
        'formatprg' vs. the 'equalprg', but I don't know what it is off the
        top of my head.

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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.