Thursday, May 2, 2013

Re: Still having different pwd for different windows

On 22:42 Wed 01 May , AndyHancock wrote:
> On Apr 29, 5:09 am, Marcin Szamotulski wrote:
> > If the above will not solve your problem you can record your local
> > directory in vimrc:
> >
> > let g:pwd = getcwd()
> >
> > and in a '.vim/after/plugin/myscript.vim' use:
> >
> > set noautochdir
> > exe 'cd '.fnameescape(g:pwd)
> >
> > If this was due to lcd used somewhere it should solve it. I assume
> > that it only happens on startup, if not you might need to use
> > autocommands. Maybe it only happens with some file type?
>
> Unfortunately, it doesn't just happen at startup. I haven't been able
> to determine the triggering event.
>
> I'm still unclear about how the after directory works. When do which
> files get invoked? I was confused by the help for "after".
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

The scripts in the after directory will be executed after other scripts.
For example if you have
~/.vim/plugin/p1.vim

and
~/.vim/after/plugin/p2.vim

the second one will be executed after the first one (i.e. the scripts
under 'after/plugin/' are executed after all the scripts under
'plugin/'). The same applies to any other directories (ftplugin vs
after/ftplugin, syntax vs after/syntax, etc). I often use the after
directory to add some features to syntax files with, for example in

~/.vim/after/syntax/vim.vim

You can add additional syntax rules to the standard syntax/vim.vim
file. If you'd place it without the '/after' directory it would
execute and the one under $VIMRUNTIME/syntax/vim.vim would not.

The next level are autocommands, for example the FileType autocommand
group is executed after the ~/.vim/ftplugin/... script and even after
~/.vim/after/ftplugin/... (where the ... correspond to the specific file
type).

I hope it explains the after directory a bit. You can experimant with
them by putting a simple script which just echoes a message:

Pu this in '~/.vim/plugin/test.vim':
echom 'plugin/test.vim'

and this in '~/.vim/after/plugin/test.vim':
echom 'after/plugin/test.vim'

there is VimEnter autocommand group which is fired as the last step of
the vim start-up (actually almost the last, since it is before running
the --cmd vim command line argument :).


As for your problem: have you checked where autochdir get set, this
command might help you:
:verbose set acd?
otherwise you can bisect your plugins (turn some of them off
and check if it happens) or grep which one is useing :lcd or :cd command
without reverting the change.

Best regards,
Marcin

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: