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

Re: :silent ! requires redraw!

Expand Messages
  • Sung Pae
    ... I think the major reason why people prepend `silent` to `!` commands is to avoid the Press Enter to continue prompt, as recommended in the help: Vim
    Message 1 of 6 , Mar 8, 2013
    • 0 Attachment
      On Fri, Mar 08, 2013 at 10:44:37PM +0100, Bram Moolenaar wrote:
      >
      > Sung Pae wrote:
      >
      > > On Fri, Jan 25, 2013 at 03:07:45AM -0600, Brian Lewis wrote:
      > >
      > > > After ":silent !", vim looks blank. I have to ^L or ":redraw!" to make
      > > > it look normal.
      > >
      > > I decided I wanted to change this as well; simple patch is attached. It
      > > appears that when do_shell() is called while msg_silent > 0, the screen
      > > is not set to redraw. This may be by design, so I'm not advocating for
      > > change, but you may find it useful.
      >
      > The point of using silent with a shell command is that Vim will not
      > redraw the screen. If you want to update the screen, just leave out the
      > silent.

      I think the major reason why people prepend `silent` to `!` commands is
      to avoid the "Press Enter to continue" prompt, as recommended in the
      help:

      Vim redraws the screen after the command is finished,
      because it may have printed any text. This requires a
      hit-enter prompt, so that you can read any messages.
      To avoid this use: >
      :silent !{cmd}

      But now that I think of it, if I want to avoid affecting the screen at
      all, it would be more appropriate to use `call system(…)`. Perhaps this
      deserves a mention in this section of the documentation?

      guns

      --
      --
      You received this message from the "vim_dev" 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_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • ZyX
      ... It would not be. At least not until somebody fixes ... , meaning that I cannot use `system()` when creating library function that must be designed to work
      Message 2 of 6 , Mar 9, 2013
      • 0 Attachment
        > But now that I think of it, if I want to avoid affecting the screen at
        > all, it would be more appropriate to use `call system(…)`. Perhaps this
        > deserves a mention in this section of the documentation?

        It would not be. At least not until somebody fixes

        > Newlines in {expr} may cause the command to fail.

        , meaning that I cannot use `system()` when creating library function that must be designed to work also with cases like `hg commit -m $'Summary\n\nVerbose description'` (I know that this case may be changed to use `hg commit -l`, but it is not the only case when I use newlines; though all others happen only in shell).

        --
        --
        You received this message from the "vim_dev" 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_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+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.