Reply to message «Re: grep quickfix window question», sent 19:04:54 15 October 2010, Friday by Gary Johnson:
> It looked to me like it was global, too, but ":help cursorline" says > that it's local to the window. What's happening is that new windows > inherit at least some of the settings of the windows from which they > are created. No, it is partially false. The problem here is that `:set' command sets both global and local values, you should use `:setlocal' to set only local value without touching global. More info is available in :h local-options. The following code works just fine: autocmd Filetype qf setlocal cursorline Original message: > On 2010-10-15, Jim Green wrote: > > On Oct 15, 9:31 am, Gary Johnson <garyj...@spocom.com> wrote: > > > This is what I did. > > > > > > $ vim -N -u NONE > > > > > > :set cursorline > > > :au FileType QF nmap <buffer> <cr> <cr><c-w><c-p> > > > :grep PATTERN * > > > :cw > > > > > > where PATTERN is a string I knew would be found in some files in the > > > current directory, and 'cursorline' is set to more easily see the > > > cursor movement in the top buffer. > > > > > > At this point, moving the cursor in the quickfix window and hitting > > > Enter works as advertised: the cursor moves to the correct file and > > > line in the top window and returns to the quickfix window. > > > > This works well, but looks like set cursorline is global, could I have > > a cursorline just when I do :grep and :cw ? > > It looked to me like it was global, too, but ":help cursorline" says > that it's local to the window. What's happening is that new windows > inherit at least some of the settings of the windows from which they > are created. > > If you wanted to set 'cursorline' when doing :grep, you could use > this autocommand: > > au QuickFixCmdPre * set cursorline > > I haven't found a way to automatically turn the 'cursorline' off > when the quickfix window is closed, though. > > Regards, > Gary
signature.asc
Description: This is a digitally signed message part.