Vim netrw要求"按ENTER或键入命令继续"

Edd*_*ett 8 vim netrw

我注意到当我开始这一天并打开vim,然后使用:Exp,我得到"按ENTER或键入命令继续"提示.通常在执行外部命令时显示.我不记得了:Exp过去做过这个(?).此外,提示仅在首次使用netrw时显示?!

虽然微不足道,但我觉得这很烦人.有谁知道为什么netrw这样做?我一直在删除.vimrc中的各种东西,看它们是否有任何变化,但我可能在这里待了很长时间......

重现步骤:

  • 打开vim或gvim
  • :Exp(后跟回车)
  • 出现提示.

mMo*_*ntu 5

的内容v:scrollstart可用于了解为什么会发生这种情况。

有一些选项可能与问题有关。来自vim-faq

  Vim will prompt you with the "hit enter to continue" prompt, if there are
  some messages on the screen for you to read and the screen is about to be
  redrawn.  You can add the 'T' flag to the 'shortmess' option to truncate
  all messages. This will help in avoiding the hit-enter prompt: 

      :set shortmess+=T

  You can also increase the command height by setting the 'cmdheight' option: 

      :set cmdheight=2

  For more information, read 

      hit-enter
      avoid-hit-enter
      'shortmess'
      'cmdheight'
Run Code Online (Sandbox Code Playgroud)

编辑:

来自:h netrw-problems

P10. I'm being pestered with "[something] is a directory" and
     "Press ENTER or type command to continue" prompts...

    The "[something] is a directory" prompt is issued by Vim,
    not by netrw, and there appears to be no way to work around
    it.  Coupled with the default cmdheight of 1, this message
    causes the "Press ENTER..." prompt.  So:  read |hit-enter|;
    I also suggest that you set your |'cmdheight'| to 2 (or more) in
    your <.vimrc> file.
Run Code Online (Sandbox Code Playgroud)

您还应该检查您是否使用了最新的插件版本,因为版本 71 上有一个与您的问题相关的错误修复:

v71:           * bugfix -- made some "set nomodifiable"s into
           :
           :
           * When ch=1, on the second and subsequent uses of
             browsing Netrw would issue a blank line to clear
             the echo'd messages.  This caused an annoying
             "Hit-Enter" prompt; now a blank line message
             is echo'd only if &ch>1.
Run Code Online (Sandbox Code Playgroud)


小智 5

我通常只是:e .在当前目录中浏览。另外,要摆脱提示,您可以执行以下操作:silent Exp


alx*_*alx 5

添加这一行~/.vimrc似乎为我解决了这个问题:

let g:netrw_silent = 1
Run Code Online (Sandbox Code Playgroud)