On Mon, Jun 8, 2009 at 8:29 AM, Chris Sutcliffe wrote:
>
> I have 'set autoread' and 'set autochdir' defined in my .vimrc because
> I have debug messages dumping to a text file when I do my development,
> and I find it handy to switch between buffers and see the contents of
> the debug file without having to reload it.  The issue I have is that
> when the debug file is read, it sets the working directory, so when I
> try and run a command destined for the current buffer (in a different
> directory) the command doesn't work because the vim working directory
> is that of the debug file.  Is there a way to control this behaviour?

If instead of using 'autochdir' you go with an autocmd version, you
can be more picky about which buffers you change directories for.  I
personally go with this one:

      au BufEnter * if &ft != 'help' | silent! cd %:p:h | endif

That changes to the directory of the file being edited, unless that
file is a help file.  It would be easy enough to change that to only
cd if some buffer-local variable is not set, otherwise indicating that
the buffer is some sort of scratch log file.  Does that get you far
enough along?

~Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to