Wednesday, April 3, 2013

Re: execute user defined command and press enter

On 2013-04-03, FlashBurn wrote:
> I created the following command
> command! -nargs=1 Vim :call VimGrep("<args>", g:dir_list) | copen | cc
>
> The problem that I'm having is that it is asking me to press enter
> after it is executed. How can I avoid it? How can I make it open
> the quickfix list automatically without vim telling me to press
> enter. I tried putting <cr> at the end of the command, but then I
> get following error:
>
> E488: Trailing characters cc^M
>
> Any help is appreciated.

That depends on what's causing it to need the enter. I don't have a
VimGrep() function installed, so I used an arbitrary function from
":help functions" instead.

:command! -nargs=1 Vim :call findfile("<args", "/usr/local/bin") | copen | cc

Then I executed

:Vim vim

It worked fine. (I got the error "E42: No Errors", but that was to
be expected.)

So the problem may be from something inside your VimGrep() function.
What does your command do if you don't include the "| copen | cc"
part, i.e.,

command! -nargs=1 Vim :call VimGrep("<args>", g:dir_list)

Regards,
Gary

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: