[libvirt] [PATCH] Add vim configuration that makes vim auto-indent code

Wen Congyang wency at cn.fujitsu.com
Wed Mar 16 09:11:41 UTC 2011


At 03/16/2011 04:59 PM, Hu Tao Write:
> On Wed, Mar 16, 2011 at 03:54:26PM +0800, Daniel Veillard wrote:
>> On Wed, Mar 16, 2011 at 10:53:27AM +0800, Hu Tao wrote:
>>> ---
>>>  .lvimrc |   10 ++++++++++
>>>  HACKING |    5 +++++
>>>  2 files changed, 15 insertions(+), 0 deletions(-)
>>>  create mode 100644 .lvimrc
>>>
>>> diff --git a/.lvimrc b/.lvimrc
>>> new file mode 100644
>>> index 0000000..3a732ce
>>> --- /dev/null
>>> +++ b/.lvimrc
>>> @@ -0,0 +1,10 @@
>>> +set nocompatible
>>> +filetype on
>>> +set autoindent
>>> +set smartindent
>>> +set cindent
>>> +set tabstop=4
>>> +set shiftwidth=4
>>> +set expandtab
>>> +set cinoptions=(0,:0,l1,t0
>>> +filetype plugin indent on
>>> diff --git a/HACKING b/HACKING
>>> index 4a71b37..adfb7ae 100644
>>
>>   Heh, I use vim, but I would rather not put a configuration file in the
>> tree, especially with autoindent which may defeat people typing habits.
> 
> Agree. But do you think the script (see changes of HACKING file of this
> patch) is useful? with it the .lvimrc(not .vimrc) takes effect only if
> editing libvirt code, and there is no need to append it to ~/.vimrc.

We use tab in Makefile.am, so 'set expandtab' and 'set tabstop=4' are bad
settings when modifing Makefile.am.

> 
>>
>> BTW I use the following:
>>
>> set autoindent
>> set autowrite
>> set keywordprg=
>> set shiftwidth=4
>> set softtabstop=4
>> set expandtab
>> set tabstop=8
>> au FileType make setlocal noexpandtab
>> set showmode
>> syntax on
>> set backspace=2
>> set clipboard=""
>> set nohls
>> let c_space_errors=1
>> highlight RedundantSpaces ctermbg=red guibg=red
>> match RedundantSpaces /\s\+$\| \+\ze\t/
>>
>>   BTW the last lines shows up in red any trailing spaces left at the end
>> of lines, tip given by Jim Meyering a couple of years ago
> 
> Thank you, it helps catching trailing spaces early in vim. (although git
> diff can do it)
> 




More information about the libvir-list mailing list