>
>
> On Jun 18, 4:09 pm, Tony Mechelynck<antoine.mechely...@gmail.com>
> wrote:
>> On 13/04/10 13:28, Aarto Matti wrote:
>>
>>> So I added this into my .vimrc to fix the problem:
>>> autocmd BufRead * execute ":cd ".getcwd()
>>
>> This should be a no-operation, unless the current window has a local
>> directory (set by :lcd) in which case (IIUC) it sets the global working
>> directory to the current local directory. Not what I would want.
>>
>>
>
> That's the point. This SHOULD be a no-operation, but it isn't. I can't
> reproduce this reliably, but from time to time, I also see file paths
> that are not simplified with respect to the current directory on a
> fresh file load. Simply issuing :e after loading the file corrects the
> issue for me (I have 'autochdir' set). The OP is saying that all it
> takes is a ':cd .'. Presumably an :lcd would do something similar.
>
Yes, sorry I didn't reread the upthread.
However my point is that ":exe 'cd' getcwd()" is NOT a no-operation if
the current window is under the effect of :lcd. Example:
- current directory is /foo
- open 2 windows
window 1, cd is /foo, no lcd
window 2, cd is /foo, no lcd
- in window 2, do :lcd /bar
window 1, cd is /foo, no lcd
window 2, lcd is /bar
- still in window 2, do :exe 'cd' getcwd()
window 1, cd is /bar, no lcd
window 2, cd is /bar, no lcd
(current directory for window 1 has changed).
OTOH ":lcd ." is not a no-operation if the current window is not yet
under :lcd, because it uncouples this window's lcd from the global setting:
window 1, cd is /foo, no lcd
window 2, cd is /foo, no lcd
:cd /bar
window 1, cd is /bar, no lcd
window 2, cd is /bar, no lcd
(both change). ":lcd ." in window 2
window 1, cd is /bar, no lcd
window 2, lcd is /bar
then :cd /foo in window 1
window 1, cd is /foo, no lcd
window 2, lcd is still /bar
if we hadn't done :lcd . in window 2, its current dir would now be /foo
Best regards,
Tony.
--
Anyone can make an omelet with eggs. The trick is to make one with
none.
--
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
No comments:
Post a Comment