tags:

views:

339

answers:

5

So I was hoping that some old school Vim'ers could help me out. These are all separate questions and normally I would put them up each on their own but I'm not sure if that qualifies as question whoring here.

Plus I think if you know enough to be asking any of these questions they will all be coming up in the near future:

  1. I have a library I'm writing and a series of applications that use that library. There doesn't seem to be an easy way(from what I can tell) to build a ctags file for the library and build one for each of my applications and make sure one references the other when I'm in vim.
  2. Using gf to open files from command mode is awesome, but a lot of my include files don't contain the full path. They refer to an include directory I set in the IDE. How can I set this directory as another point for Vim to start looking for files?
  3. Is there a way to compile a file inside Vim and send the output to a buffer? I'm currently using MSVS 2k3 but I'll be porting over to Linux in a few weeks so if this is possible on either system I'd appreciate it.
+2  A: 

Re 3)

If you put a makefile in your root dir, you can simply write :make

This will run make and (iirc) put any errors into a seperate buffer, and make vim goto the first compile error. From there you can navigate all erroring lines using :next-error

Also, see this page http://wiki.beyondunreal.com/Legacy:Vim

and http://linux.byexamples.com/archives/287/perform-grep-and-make-in-vim/

for details on how to show the result in a seperate console.

Soraz
A: 

2)

:cd {path}

For help:

:he cd

A few others like :lcd might be better suited. Just scroll down that help page.

Ali A
+2  A: 

1- tags files are independent, and can be used together. See :h 'tags'

I can't tell what is the easy way to build tags files. I have one that consists in using two plugins of mine:

  • one (draft) plugin that knows how to update C++ tags files (it should be easy to adapt it to other filetypes),
  • and another (local_vimrc) that helps me define directories-local .vimrc. Thus for any files within a given directory hierarchy, I can adapt the &tags options to use the relevant tag files, and the current tag file that will be rebuilt automatically (or when a keybinding is triggered). (Plugins like project should do the trick as well)

2- :h 'path'

3- :h :make

HTH.

Luc Hermitte
A: 

This is rather off topic, but might still be useful: if you're using Visual Studio a lot and like Vim, you might want to look at ViEmu. It's the best Vim-emulation for any IDE I've yet seen, and the cost is really low. :) And no, I'm not getting a commission. :P

Rytmis
A: 

It's not obvious, but if you open a directory instead of a file, it's nicely browseable.

e.g.

:e . (colon-e-dot) :e .. (colon-e-dot-dot)

will let you browse from your current directory or its parent.

(understanding that you were probably hoping for a capability to have vim accept e.g.

:e abc.txt

and have it look in several directories, which I don't know how to do.)

le dorfier
Luc Hermitte