Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use TODO word in a comment as todolist item

" TODO this is a todolist item

and I show the items with

nn <silent><leader>tl :grep --exclude=*~ TODO % <CR> :copen <CR>

but with the first part of command (the grep section), vim clear the screen, this is very ugly.

how I can send the grep output to background and only display the copen window ?

share|improve this question
up vote 0 down vote accepted

Use :vimgrep instead of :grep.

:grep uses an external program, that's why it's "suspending" Vim. :vimgrep is an internal feature and, as such, doesn't "suspend" Vim.

:vimgrep can be slower than :grep when dealing with large numbers of files but it shouldn't be a problem in your case.

Did you consider /TODO<CR>?

share|improve this answer
    
I don't like /TODO<cr>, because with copen I can move over todolist items – juanpablo Jun 18 '12 at 14:26
    
ok, with you suggestion I change to nn <silent><leader>tl :vimgrep TODO % <CR> :copen <CR> – juanpablo Jun 18 '12 at 14:30
1  
You don't need <silent>, you have too many <CR>s and this seems to be a perfect usecase for |. Try nnoremap <leader>tl :vimgrep TODO % \| copen<CR>. – romainl Jun 18 '12 at 14:36
    
I like more <tab> that \| – juanpablo Jun 18 '12 at 15:04
    
but, when I use \| or <tab> in some case I get Press ENTER or type command to continue, with <CR> I don't get this output – juanpablo Jun 18 '12 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .