Re: synchronize current working directory - problem with vim7
K.S.Sreeram wrote: Gerald Lai wrote: For Netrw v98, this hack seems to make it work as requested: Doesn't work for me :( I installed the Decho plugin, and noticed that the 'cd' command inside netrw works, but looks like something else is resetting the directory back to the original value! Is there some way I can 'hook' into the inbuilt cd/lcd commands so that I can insert some print statements to see what is going on? Regards Sreeram Didn't you have an autocommand with :cd %:p:h in it? If % is a directory, that would get you to its parent. If 'autochdir' and the mechanism provided by netrw aren't working, then you may need something more complicated, e.g.: function s:GoToFileDir(file) if isdirectory(a:file) exe "lcd" a:file else exe "lcd" expand(a:file . ":p:h") endif endfunction autocmd BufRead,BufNewFile,BufFilePost * \ call GoToFileDir() Best regards, Tony.
Re: synchronize current working directory - problem with vim7
Gerald Lai wrote: > For Netrw v98, this hack seems to make it work as requested: Doesn't work for me :( I installed the Decho plugin, and noticed that the 'cd' command inside netrw works, but looks like something else is resetting the directory back to the original value! Is there some way I can 'hook' into the inbuilt cd/lcd commands so that I can insert some print statements to see what is going on? Regards Sreeram signature.asc Description: OpenPGP digital signature
Re: synchronize current working directory - problem with vim7
On Sat, 17 Jun 2006, K.S.Sreeram wrote: [EMAIL PROTECTED] wrote: :he netrw-problems In particular, look at P6. Thanks for the pointer, but unfortunately doing let g:netrw_keepdir = 0 in _vimrc file does not seem to have any effect at all! Here's what happens: 1) run gvim.exe 2) :pwd (output: c:\Vim\vim70) 3) :e c:\Projects\Test\ (shows directory listing) 4) :pwd (output: c:\Vim\vim70) If I have 'set autochdir', then : 3) :e c:\Projects\Test (shows directory listing) 4) :pwd (output: c:\Projects) (I'd like this to be c:\Projects\Test!) So in either case, g:netrw_keepdir=0 doesn't have any effect at all, I even tried with a fresh install of vim7 without any extra plugins and the result was the same! How do I solve this? Sreeram, For Netrw v98, this hack seems to make it work as requested: (1) Do NOT set g:netrw_keepdir at all in vimrc. (2) Edit $VIMRUNTIME/autoload/netrw.vim Change line 2887 from if !g:netrw_keepdir to if g:netrw_keepdir Chip, Something in the other if !g:netrw_keepdir .. endif blocks is causing the trouble for the if block at line 2887. HTH. -- Gerald
Re: synchronize current working directory - problem with vim7
On Sat, 17 Jun 2006, K.S.Sreeram wrote: [EMAIL PROTECTED] wrote: :he netrw-problems In particular, look at P6. Thanks for the pointer, but unfortunately doing let g:netrw_keepdir = 0 in _vimrc file does not seem to have any effect at all! Here's what happens: 1) run gvim.exe 2) :pwd (output: c:\Vim\vim70) 3) :e c:\Projects\Test\ (shows directory listing) 4) :pwd (output: c:\Vim\vim70) If I have 'set autochdir', then : 3) :e c:\Projects\Test (shows directory listing) 4) :pwd (output: c:\Projects) (I'd like this to be c:\Projects\Test!) So in either case, g:netrw_keepdir=0 doesn't have any effect at all, I even tried with a fresh install of vim7 without any extra plugins and the result was the same! How do I solve this? Chip, Like Sreeram, I was also trying to get g:netrw_keepdir to work but was unsuccessful with Netrw v102b. -- Gerald
Re: synchronize current working directory - problem with vim7
[EMAIL PROTECTED] wrote: > :he netrw-problems > > In particular, look at P6. Thanks for the pointer, but unfortunately doing let g:netrw_keepdir = 0 in _vimrc file does not seem to have any effect at all! Here's what happens: 1) run gvim.exe 2) :pwd (output: c:\Vim\vim70) 3) :e c:\Projects\Test\ (shows directory listing) 4) :pwd (output: c:\Vim\vim70) If I have 'set autochdir', then : 3) :e c:\Projects\Test (shows directory listing) 4) :pwd (output: c:\Projects) (I'd like this to be c:\Projects\Test!) So in either case, g:netrw_keepdir=0 doesn't have any effect at all, I even tried with a fresh install of vim7 without any extra plugins and the result was the same! How do I solve this? Thanks in advance! Sreeram signature.asc Description: OpenPGP digital signature
Re: synchronize current working directory - problem with vim7
Quoting "K.S.Sreeram" <[EMAIL PROTECTED]>: > Chris Sutcliffe wrote: > > if exists('+autochdir') > >set autochdir > > else > >autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ / > > endif > > > > In my _vimrc and it's worked beautifully in both vim 6 and vim 7. > > I just tried 'autochdir', and when i'm browsing a directory, it seems to > set the current working directory to the *parent* of the directory.\ > > For instance, if i'm browsing 'c:\projects\mypetproject\', the current > directory is being set to 'c:\projects', how do i make it so that the > current directory is set to 'c:\projects\mypetproject\'? Assuming you're using netrw to do your browsing; look at :he netrw-problems In particular, look at P6. Regards, Chip Campbell
Re: synchronize current working directory - problem with vim7
Chris Sutcliffe wrote: > if exists('+autochdir') >set autochdir > else >autocmd BufEnter * silent! lcd %:p:h:gs/ /\\ / > endif > > In my _vimrc and it's worked beautifully in both vim 6 and vim 7. I just tried 'autochdir', and when i'm browsing a directory, it seems to set the current working directory to the *parent* of the directory.\ For instance, if i'm browsing 'c:\projects\mypetproject\', the current directory is being set to 'c:\projects', how do i make it so that the current directory is set to 'c:\projects\mypetproject\'? Thanks in advance! Sreeram signature.asc Description: OpenPGP digital signature
synchronize current working directory - problem with vim7
Hi All I'm using the CD.vim script from: http://vim.sourceforge.net/scripts/script.php?script_id=65 to synchronize the current working directory with the current buffer. au BufEnter * execute ":lcd " . expand("%:p:h") On Vim7, when I browse directories (e.g :e c:\Projects)... the current working directory does not get updated. How do I fix this? Thanks in Advance! Sreeram signature.asc Description: OpenPGP digital signature