Add vim configuration that makes vim auto-indent code

This commit is contained in:
Hu Tao 2011-03-17 10:35:17 +08:00 committed by Eric Blake
parent d69171566d
commit 838f669682
3 changed files with 49 additions and 0 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@
*~
.git
.git-module-status
.lvimrc
.sc-start-sc_*
/ABOUT-NLS
/COPYING

22
HACKING
View File

@ -87,6 +87,28 @@ If you use Emacs, add the following to one of one of your start-up files
'(lambda () (if (string-match "/libvirt" (buffer-file-name))
(libvirt-c-mode))))
If you use vim, append the following to your ~/.vimrc file:
set nocompatible
filetype on
set autoindent
set smartindent
set cindent
set tabstop=8
set shiftwidth=4
set expandtab
set cinoptions=(0,:0,l1,t0
filetype plugin indent on
au FileType make setlocal noexpandtab
au BufRead,BufNewFile *.am setlocal noexpandtab
match ErrorMsg /\s\+$\| \+\ze\t/
Or if you don't want to mess your ~/.vimrc up, you can save the above into a
file called .lvimrc (not .vimrc) located at the root of libvirt source, then
install a vim script from
http://www.vim.org/scripts/script.php?script_id=1408, which will load the
.lvimrc only when you edit libvirt code.
Code formatting (especially for new code)
=========================================

View File

@ -101,6 +101,32 @@
(libvirt-c-mode))))
</pre>
<p>
If you use vim, append the following to your ~/.vimrc file:
</p>
<pre>
set nocompatible
filetype on
set autoindent
set smartindent
set cindent
set tabstop=8
set shiftwidth=4
set expandtab
set cinoptions=(0,:0,l1,t0
filetype plugin indent on
au FileType make setlocal noexpandtab
au BufRead,BufNewFile *.am setlocal noexpandtab
match ErrorMsg /\s\+$\| \+\ze\t/
</pre>
<p>
Or if you don't want to mess your ~/.vimrc up, you can save the above
into a file called .lvimrc (not .vimrc) located at the root of libvirt
source, then install a vim script from
http://www.vim.org/scripts/script.php?script_id=1408,
which will load the .lvimrc only when you edit libvirt code.
</p>
<h2><a name="formatting">Code formatting (especially for new code)</a></h2>
<p>