Ben Fritz wrote: > On Feb 1, 4:29 pm, Ben Fritz <[email protected]> wrote: > > Trying to grep an entire project tree fails with autochdir set: > > > > gvim -N -u NONE -i NONE C:/path/to/project/dir/relative/path/in/ > > project/somedir/file.c > > set autochdir > > cd C:/path/to/project/dir > > vimgrep /pattern/j relative/path/in/project/**/*.[ch] > > > > Gives: > > C:\path\to\project\dir > > "relative\path\in\project\somedir\file.c" [New DIRECTORY] > > C:\path\to\project\dir > > "relative\path\in\project\somedir\file2.c" [New DIRECTORY] > > C:\path\to\project\dir > > "relative\path\in\project\somedir\file3.c" [New DIRECTORY] > > ... > > E480: No match: pattern > > > > But without the set autochdir, the vimgrep correctly finds all > > occurrences of pattern in the project. > > > > I'm about 95% sure this worked at some point in the past, because this > > is how I've done similar searches before. > > > > Actually, it turns out, the issue has been around a long time. I went > back to 7.2.160 and the issue exists there as well. > > This patch fixes it, but probably a better way would be to insert the > directory restore code in each "dummy_buffer" function. Is there a way > to detect whether 'cd' or 'lcd' was used, as well? It seems that > assuming the user used :lcd is an assumption which might bite somebody > at some point. > > Based off v7.3.393.
This repeats the same code several times. Please move it to a function. Instead of guessing whether :lcd or :cd was used it would be better to check the actual situation. Probably by checking the value of curwin->w_localdir. -- How To Keep A Healthy Level Of Insanity: 9. As often as possible, skip rather than walk. /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- You received this message from the "vim_dev" 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
