[Assorted-commits] SF.net SVN: assorted:[905] configs/trunk/src/vim/plugin/_yang.vim
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-07-25 02:03:12
|
Revision: 905 http://assorted.svn.sourceforge.net/assorted/?rev=905&view=rev Author: yangzhang Date: 2008-07-25 02:03:21 +0000 (Fri, 25 Jul 2008) Log Message: ----------- got project-wide settings to work Modified Paths: -------------- configs/trunk/src/vim/plugin/_yang.vim Modified: configs/trunk/src/vim/plugin/_yang.vim =================================================================== --- configs/trunk/src/vim/plugin/_yang.vim 2008-07-24 16:25:42 UTC (rev 904) +++ configs/trunk/src/vim/plugin/_yang.vim 2008-07-25 02:03:21 UTC (rev 905) @@ -39,16 +39,14 @@ - - -function ProjectDir() - let dir = expand('%:h') +function! ProjectDir() + let dir = expand('%:p:h') if (dir =~ "^$") let dir = getcwd() endif - while isdirectory(dir) && + while isdirectory(dir) && \dir !~ '^/*$' && - \glob(dir . "/.project.vim") !~ "^$" + \glob(dir . "/.project.vim") =~ "^$" let dir = fnamemodify(dir, ":h") endwhile if glob(dir . "/.project.vim") =~ "^$" @@ -57,7 +55,7 @@ return dir endfunction -" XXX Why doesn't this work the first time if I directly load a file from the command line, eg "vim foo.cc"? +" XXX This doesn't work for setting options on the triggering buffer. " XXX This is highly insecure; should only allow the same things allowed in modelines. autocmd BufNewFile,BufRead * if glob(ProjectDir() . "/.project.vim") !~ "^$" | execute "source " . ProjectDir() . "/.project.vim" | endif @@ -194,7 +192,7 @@ au BufNewFile,BufRead *.map setf map " temporaries autocmd BufNewFile,BufRead *.{lzz,tt,tcc} setlocal filetype=cpp -autocmd BufNewFile,BufRead *.{c,cc,cpp,cxx,h,lzz,tt,tcc} setlocal cindent expandtab softtabstop=2 shiftwidth=2 tabstop=8 +"autocmd BufNewFile,BufRead *.{c,cc,cpp,cxx,h,lzz,tt,tcc} setlocal cindent expandtab softtabstop=2 shiftwidth=2 tabstop=8 autocmd BufNewFile,BufRead *.java setlocal cindent noexpandtab softtabstop=4 shiftwidth=4 tabstop=4 autocmd BufNewFile,BufRead *.lzx setlocal filetype=lzx " autocmd GDB This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |