]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add vim configuration that makes vim auto-indent code
authorHu Tao <hutao@cn.fujitsu.com>
Thu, 17 Mar 2011 02:35:17 +0000 (10:35 +0800)
committerEric Blake <eblake@redhat.com>
Thu, 17 Mar 2011 23:08:51 +0000 (17:08 -0600)
.gitignore
HACKING
docs/hacking.html.in

index 41f7654c0902194154a74edca807c401bd2caaab..e8c907ead48ee309423b7d3b11439bec2010756c 100644 (file)
@@ -15,6 +15,7 @@
 *~
 .git
 .git-module-status
+.lvimrc
 .sc-start-sc_*
 /ABOUT-NLS
 /COPYING
diff --git a/HACKING b/HACKING
index 4a71b370cfa2ac2480eebcf3c236be73e2da3371..b2ceaa7db1add5e2953ee1b315a4dc4e1e83ca2c 100644 (file)
--- 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)
 =========================================
index 0d81b0bed1c5419e505eca6179a66f176460f079..e0484dd5999e13b62cdad0b75ea06766804e29c1 100644 (file)
                             (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>