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

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

Expand Messages
  • arjicot@...
    May 23, 2013
    • 0 Attachment
      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, arj...@... 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

      ############################################
      " gnome-shell workaround http://askubuntu.com/questions/67/how-do-i-enable-full-color-support-in-terminal
      if $COLORTERM == 'gnome-terminal'
      set t_Co=256
      endif

      syntax on
      autocmd FileType cpp set formatprg=astyle\ -s2pPA1
      set number " show numbers on the left side
      set scrolloff=5 " keep at least 5 lines above/below
      set sidescrolloff=5 " keep at least 5 lines left/right

      " tab & space related settings
      set tabstop=2
      set shiftwidth=2
      set expandtab

      colorscheme distinguished

      " PLUGINS SETTINGS

      " pathogen
      " execute pathogen#infect()

      " clang_complete settings
      let g:clang_user_options="-std=c++0x"
      ############################################

      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.

      --
      --
      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.
    • Show all 12 messages in this topic