On Tue, Feb 24, 2009 at 6:05 PM, Samuel Ferencik <[email protected]> wrote:
> Basically, I am looking for a way (an autocmd, perhaps) to change the
> path to the file being opened - before it is opened. I can determine
> the physical path by an external (system) command. Suppose there is a
> call "translate-path" and
> translate-path MY_SOURCES:SETUP.COM
> returns the string
> PATH:[TO.MY.SCRIPTS]SETUP.COM
>
> I tried something like this:
> autocmd BufReadPre *.* execute "e " . system("translate-path " .
> expand("%"))
> but I got
> E201: *ReadPre autocommands must not change current buffer
>
> Do you see a way of doing this?
As the autocommand does not allow changing the current buffer, an
alternative is to *not* specify MY_SOURCES in your 'path' setting.
Instead specify all the path that is defined in MY_SOURCES in your 'path',
e.g:
set path=.,PATH:[TO.MY.SOURCES],PATH:[TO.MY.HEADERS], and so on
Otherwise define your own user defined command (:he user-commands) that
will do the path mangling.
nazri
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---