From 838f66968232a27d1867b4b2549e97bb58f6d490 Mon Sep 17 00:00:00 2001 From: Hu Tao Date: Thu, 17 Mar 2011 10:35:17 +0800 Subject: [PATCH] Add vim configuration that makes vim auto-indent code --- .gitignore | 1 + HACKING | 22 ++++++++++++++++++++++ docs/hacking.html.in | 26 ++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) diff --git a/.gitignore b/.gitignore index 41f7654c09..e8c907ead4 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ *~ .git .git-module-status +.lvimrc .sc-start-sc_* /ABOUT-NLS /COPYING diff --git a/HACKING b/HACKING index 4a71b370cf..b2ceaa7db1 100644 --- a/HACKING +++ b/HACKING @@ -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) ========================================= diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 0d81b0bed1..e0484dd599 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -101,6 +101,32 @@ (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)