Reputation: 334
I would like to create a vim command that is waiting for an input THEN that will execute ':cw' automatically after the first command.
Here is what I try:
noremap <C-p> :exec ":ProjectGrep /".input('Search: ')"/ src/**"<CR>:cw
But the ':cw' does not execute after the command, it complete the input().
Upvotes: 0
Views: 150
Reputation: 196516
Add the following snippet to your vimrc
to make Vim open the quickfix/location window when there are valid errors/locations:
augroup qf
autocmd!
autocmd QuickFixCmdPost [^l]* cwindow
autocmd QuickFixCmdPost l* lwindow
augroup END
That snippet addresses what I believe is your underlying issue (having the quickfix window open automatically after your search command), though, not your actual question.
Anyway, cwindow
should be the last command in the function called by your :ProjectGrep
command; not at the mapping level.
Upvotes: 3