Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread Bernat Tallaferro
On Fri, 2006-06-23 at 00:03 +0200, A.J.Mechelynck wrote:

> Hm. With which pattern are you invoking this command? And what is the 
> current directory? (use the ":pwd" command if you arren't sure.)

I'm on /home/dpm/project/src, editing myfile.c. 

I don't know whether this is relevant, but I usually start editing files
with gvim by right-clicking on them on the file manager and choosing
"Edit with GVim" (I'm using Nautilus on GNOME). The only side-effect of
this, is that the pwd is always set to /home/dpm, so I usually have to
do an :lcd %:h if I need to do any file-related stuff.

So, to recap:

* My .vimrc contains this:
command! VimGrep -nargs=1 -bar -bang
\   vimgrep  ../inc/*.h ../src/*.c

(I guess that ../src/*.c should simply be *.c, but changing that does
not solve the issue)

* pwd returns /home/dpm/project/src

* It doesn't matter which pattern I use, I always get the "E488:
Trailing characters" whenever I execute:

:VimGrep pattern

as an example, the last pattern I used was:

:VimGrep static

Thanks for your help (and your patience).




Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread Bernat Tallaferro
Hi Tony,

I'm still getting the "E488: Trailing characters" error with this:

On Thu, 2006-06-22 at 23:32 +0200, A.J.Mechelynck wrote:

>   command! VimGrep -nargs=1 -bar -bang
>   \   vimgrep  ../inc/*.h ../src/*.c

Any ideas?





Re: A couple of questions about tags, directories and vimgrep

2006-06-22 Thread Bernat Tallaferro
Tony,

thanks for your reply. I'm sorry if I'm asking something obvious, but
adding this to my .vimrc file:

On Thu, 2006-06-22 at 22:23 +0200, A.J.Mechelynck wrote:

> 2.
>   command VimGrep -nargs=1 -bar -bang
>   \   vimgrep  ../src/*.c,../inc/*.h
> 

gives me an "E488: Trailing characters" error whenever I try to
execute :VimGrep /my-pattern/

I've had a look at :h E488, but I did not quite get what could be
causing this.

Thanks.




A couple of questions about tags, directories and vimgrep

2006-06-22 Thread Bernat Tallaferro
Hi,

I started using vim a couple of weeks ago, and although I find it an
amazing editor, I'm still struggling with things that seem to be "common
practice" in the vim world but are not so obvious for people like me who
have always worked with IDEs.

Therefore my questions:

a) I'm working on a project where the C source files are in ./src and
the headers in ./inc. I have created a tags file under every one of the
two folders. I normally work in ./src, and my tags entry in .vimrc is
set to ./tags ../inc/tags. However, when I open a *.h file for editing
in ./inc and I :cd to the ./inc folder, whenever I try to jump to a tag
in the *.h file, vim does not recognise the tag. What would be the best
way to solve this? I know I can create a tags file at the top directory,
but then I cannot use the "Build tags in the current directory tree"
menu entry, since it only works for the current directory (which is
normally ./src in my case)

What I really mean is, what is the standard way of working with tags,
where are the tag files normally placed?

b) Is there a way I can tell vimgrep to always look for the given
pattern at some standard location? I usually invoke vimgrep as
'vimgrep /pattern/ *.c ../inc/*.h', and I'd like to know if there is a
way to specify '*.c ../inc/*.h' to be the default files in which to look
for the pattern, so I only have to type 'vimgrep /pattern/'.

Many thanks in advance.