Friday, February 25, 2011

Re: Is it possible to automatically identify the current line with [I?

On Fri, Feb 25, 2011 at 4:53 PM, Shawn Young <spacephys@gmail.com> wrote:
On Fri, Feb 25, 2011 at 12:44 PM, Michael(Xi Zhang)
 >>
>> --
>> Shawn Young
>
> You can try  :vimgrep /<C-R><C-W>/j %<cr>
> The command will search the word under the cursor in current file(% -
> current file). The results are in quickfix window. If you don't use the
> option 'j', it will jump to the first search result.
>
> Then you need use :cw<cr> to open the quickfix window.
>
> Or you can combine the two command together:  :vimgrep /<C-R><C-W>/j %<cr>
> \| :cw <cr>
>

Thanks Michael,

I have not tried to put this in my .vimrc yet, but in doing it
manually I don't see anything that indicates which line my cursor is
on.  What should I see?

-shawn
> Or map the command to shortcut, for example:
> map  <F6>   <Esc>:vimgrep /<C-R><C-W>/j %<cr> \| :cw<cr>
>
> Check out
> :help vimgrep
>
> Michael
>
>

Yes, this method doesn't mark the current line in the search result.
Anyway, you can see your current line in the window, and all the results in quickfix window.

:cw will open a window under the window you are working, you can use height to set the quickfix window's height, such as :cw8 will open the quickfix window with 8 lines.

check out 
:help :cw 

--
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: