autochdir

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

autochdir

Sean Hubbell
Hello,

  A long time ago I had something set up in my .vimrc file to change the
working directory to the location of the file I was editing. Since this
was in the mid 90's I cannot remember so may be this functionality is
obsolete now but when I was going through the help I found autochdir but
this does not work for me. Does anyone have this working for them?

Thanks,

Sean
Reply | Threaded
Open this post in threaded view
|

Re: autochdir

Jürgen Krämer

Hi,

Sean Hubbell wrote:
>
>   A long time ago I had something set up in my .vimrc file to change the
> working directory to the location of the file I was editing. Since this
> was in the mid 90's I cannot remember so may be this functionality is
> obsolete now but when I was going through the help I found autochdir but
> this does not work for me. Does anyone have this working for them?

  :help 'autochdir'

tells

                        {only available when compiled with the
                        |+netbeans_intg| or |+sun_workshop| feature}

But you can simulate this option with something like

  :autocmd BufRead,BufNewFile * cd %:p:h
  :autocmd BufEnter           * cd %:p:h
  ...

(You might want to use lcd instead of cd.)

Regards,
J?rgen

--
J?rgen Kr?mer                              Softwareentwicklung
HABEL GmbH & Co. KG                        mailto:[hidden email]
Hinteres ?schle 2                          Tel: +49 / 74 61 / 93 53 - 15
78604 Rietheim-Weilheim                    Fax: +49 / 74 61 / 93 53 - 99
Reply | Threaded
Open this post in threaded view
|

Re: autochdir

Sean Hubbell
J?rgen Kr?mer wrote:

>Hi,
>
>Sean Hubbell wrote:
>  
>
>>  A long time ago I had something set up in my .vimrc file to change the
>>working directory to the location of the file I was editing. Since this
>>was in the mid 90's I cannot remember so may be this functionality is
>>obsolete now but when I was going through the help I found autochdir but
>>this does not work for me. Does anyone have this working for them?
>>    
>>
>
>  :help 'autochdir'
>
>tells
>
> {only available when compiled with the
> |+netbeans_intg| or |+sun_workshop| feature}
>
>But you can simulate this option with something like
>
>  :autocmd BufRead,BufNewFile * cd %:p:h
>  :autocmd BufEnter           * cd %:p:h
>  ...
>
>(You might want to use lcd instead of cd.)
>
>Regards,
>J?rgen
>
>  
>

Thanks, I will check it out.

Do I need to add in when I save/write this file as well?

Sean