different tabspace in different projects

2 views
Skip to first unread message

allstars

unread,
Nov 4, 2009, 10:04:15 PM11/4/09
to vim_use
hello

now i work with different projects developed by different teams

however they have different tabspace setting

one is 4 and the other is 8

below is my default settings

set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab


so i am wondering is there a faster way to switch tabspace back and
forth?


thanks

James Michael Fultz

unread,
Nov 4, 2009, 10:33:09 PM11/4/09
to vim...@googlegroups.com
* allstars <allsta...@gmail.com> [2009-11-04 19:04 -0800]:

Could you set 'exrc' and create an appropriate vimrc in each project
directory?

You could also setup autocommands if your project files are in specific
directories.

au BufNewFile,BufRead /path/to/project1/* setl ts=4 sts=4 sw=4
au BufNewFile,BufRead /path/to/project2/* setl ts=8 sts=8 sw=8

Matt Wozniski

unread,
Nov 9, 2009, 8:18:29 PM11/9/09
to vim...@googlegroups.com
On Wed, Nov 4, 2009 at 10:33 PM, James Michael Fultz wrote:
>
> * allstars <allsta...@gmail.com> [2009-11-04 19:04 -0800]:
>> now i work with different projects developed by different teams
>> however they have different tabspace setting
...

>> so i am wondering is there a faster way to switch tabspace back and
>> forth?
>
> You could also setup autocommands if your project files are in specific
> directories.
>
> au BufNewFile,BufRead /path/to/project1/*        setl ts=4 sts=4 sw=4
> au BufNewFile,BufRead /path/to/project2/*        setl ts=8 sts=8 sw=8

Note that these don't have to be full paths; ie this would work:

au BufNewFile,BufRead */project1/* setl ts=8 sts=4 sw=4
au BufNewFile,BufRead */project2/* setl ts=8 sts=8 sw=8

~Matt

Reply all
Reply to author
Forward
0 new messages