Loading ...
Sorry, an error occurred while loading the content.

execute user defined command and press enter

Expand Messages
  • FlashBurn
    I created the following command command! -nargs=1 Vim :call VimGrep( , g:dir_list) | copen | cc The problem that I m having is that it is asking me to
    Message 1 of 3 , Apr 3, 2013
    • 0 Attachment
      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.

      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Ben Fritz
      ... No guarantees, but maybe this: http://vim.wikia.com/wiki/Avoiding_the_%22Hit_ENTER_to_continue%22_prompts You might also need a :silent here and there
      Message 2 of 3 , Apr 3, 2013
      • 0 Attachment
        On Wednesday, April 3, 2013 1:17:56 PM UTC-5, 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.

        No guarantees, but maybe this: http://vim.wikia.com/wiki/Avoiding_the_%22Hit_ENTER_to_continue%22_prompts

        You might also need a :silent here and there inside your function or something.

        --
        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Gary Johnson
        ... 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
        Message 3 of 3 , Apr 3, 2013
        • 0 Attachment
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.