Sideshowcoder
Sideshowcoder

Reputation: 656

Clearing the quickfix list in vim

I'm trying to clear the Quickfix list in Vim since I want to get rid of highlighting and also if I accidently created a huge list I want to clean it up so vim becomes responsive again. Closing the window will not clear the list but the contents.

Upvotes: 13

Views: 10540

Answers (1)

Sideshowcoder
Sideshowcoder

Reputation: 656

The only way I came up so far is

function ClearQuickfixList()
  call setqflist([])
endfunction
command! ClearQuickfixList call ClearQuickfixList()
nmap <leader>cf :ClearQuickfixList<cr>

EDIT (Thanks to Peter Rincker):

A better command is using cexpr [] so the command is

command! ClearQuickfixList cexpr []

Upvotes: 25

Related Questions