[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: [Xen-ia64-devel] Re: vimrc snippet
Hi Aron: Adding script in .vimrc is convenient to us, but how to the future contributors who have no configures in their .vimrc? Could we use mode-line? For example: /* vim: set tabstop=4 shiftwidth=4 expandtab: */ We can add stuff liking above in every .c/.h files so that people need not bother of .vimrc configures. Good good study,day day up ! ^_^ -Wing(zhang xin) OTC,Intel Corporation >-----Original Message----- >From: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx >[mailto:xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx] On >Behalf Of Aron Griffis >Sent: 2007?9?19? 1:14 >To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx >Subject: [Xen-ia64-devel] Re: vimrc snippet > >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/ftplugi >n/c_linux-kernel.vim > $ wget >http://n01se.net/agriffis/skel.hg/?raw-file/tip/vim/ftplugi >n/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 _______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ia64-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |