fnegroni wrote:
> There is a feature in Perforce, which allows the command line client
> (p4) to find its configuration file (.p4rc) by looking up the current
> directory and any directory above it in recursive order, stopping at
> the first one that has a .p4rc file in it. If that fails, it falls
> back to the one in the user's home directory (if there is one).
>
> It is a feature that I implemented in one of my applications recently
> (Kelp).
>
> It is a feature that I would absolutely love to have: I develop for
> several projects following different indentation styles and
> visualisation rules.
>
>
Here's some vim script to do it (loads .vimrc and tags): (unix only)
if has("unix") && getcwd() != topdir && strlen(getcwd()) > strlen(topdir)
" source any local .vimrc at the current directory or above, not
including $HOME
let vimrc=
findfile('.vimrc',getcwd().';'.substitute(getcwd(),'\('.topdir.'/[^/]\+/\).\{-}$','\1',''))
if vimrc != ""
exe "so ".vimrc
endif
" set up tags to include any and all tags files in the current
directory up to and including $HOME
" exe "set tags=".getcwd().";".expand("$HOME").",".expand("$HDR")."/tags"
let tagfiles= findfile('tags',getcwd().';'.expand("$HOME"),-1)
set tags=
for tagfile in tagfiles
exe "set tags+=".tagfile
endfor
exe "set tags+=".expand("$HDR")."/tags,".expand("$HDR")."/SYSTEM/tags"
endif
Regards,
Chip Campbell
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---