WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] Re: vimrc snippet

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] Re: vimrc snippet
From: Aron Griffis <aron@xxxxxx>
Date: Tue, 18 Sep 2007 13:13:47 -0400
Delivery-date: Tue, 18 Sep 2007 10:13:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070917142938.GB31631@xxxxxxxxx>
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
References: <20070917142938.GB31631@xxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.16 (2007-06-11)
Since I received two encouraging replies to my last post, and since
Alex mentioned to me that the snippet can cause some confusing results
without further vim configuration, here is a more complete
configuration for general C coding.

This can be cut-n-pasted directly into .vimrc

   " Tabs and indents
   set autoindent          " maintain current indent on newline
   set shiftround          " round indent < and > to multiple of shiftwidth
   set shiftwidth=4        " but see override in c_linux-kernel.vim
   set smarttab            " use shiftwidth when inserting <Tab>
   set tabstop=8           " number of spaces that <Tab> in file uses
   
   " Important for working in hardlinked trees (e.g. git or mercurial)
   set bkc+=breakhardlinks " always break hardlinks when writing
   
   " Load filetype plugins
   filetype plugin indent on
   if has("syntax")
       syntax on
   endif
   
   " Default options for C files
   autocmd FileType c,cpp let b:c_gnu=1             " highlight gcc specific 
items
   autocmd FileType c,cpp let b:c_space_errors=1    " highlight trailing w/s 
and spaces before tab
   autocmd FileType c,cpp let b:c_no_curly_error=1  " don't highlight {} inside 
()
   autocmd FileType c     let g:c_syntax_for_h=1    " use C highlighting for 
header files
   if has("cindent")
       autocmd FileType c,cpp setl cin cino=(0,u0,t0,l1  " see :help 
cinoptions-values
   endif
   
   " Match precedent in file for tabs/spaces indentation
   autocmd FileType c,cpp
               \ let tabre = '^\t\|^\( \{8}\)' |
               \ let foundtab = v:version >= 700 ?
               \     search(tabre, 'cnpw', 1000) : search(tabre, 'cnpw') |
               \ if foundtab == 1 | setlocal noexpandtab |
               \ elseif foundtab == 2 | setlocal expandtab | endif

Additionally, I have two filetype plugins for working in the Linux
kernel and working in Xen.  These set the shiftwidth (4 for xen, 8 for
Linux), include path (for example, for "gf"), tags location (use "make
tags" at the top level) and cscope database (use "make cscope" at the
top level).

    $ mkdir ~/.vim/ftplugin
    $ cd ~/.vim/ftplugin
    $ wget 
http://n01se.net/agriffis/skel.hg/?raw-file/tip/vim/ftplugin/c_linux-kernel.vim
    $ wget 
http://n01se.net/agriffis/skel.hg/?raw-file/tip/vim/ftplugin/c_xen.vim

I'd appreciate any feedback.

Thanks,
Aron

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel

<Prev in Thread] Current Thread [Next in Thread>