Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.