Vim netrw asking to "Press ENTER or type command to continue"
Asked Answered
S

3

11

I have noticed that when I start the day and open vim, then use :Exp, I get the "Press ENTER or type command to continue" prompt. Usually this is shown when an external command is executed. I don't remember :Exp doing this in the past(?). Further, the prompt is only displayed upon the first use of netrw?!

Although trivial, I find this annoying. Does anyone have an idea why netrw is doing this? I have been removing various things in my .vimrc to see if they change anything, but I could be here a long time...

Steps to reproduce:

  • Open vim or gvim
  • :Exp (followed by enter)
  • Prompt appears.
Sumter answered 14/9, 2012 at 10:12 Comment(1)
Recreated in Windows terminal Vim, with :e.. In particular, via vim -N -u NORC.Dependent
A
7

The contents of v:scrollstart can be used to get a clue of why this is happening.

There are some options that may be related to the problem. From 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'

Edit:

From :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.

You should also check if you are using the latest plugin version, as there is a bug fix on version 71 that is related to your problem:

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.
Aberrant answered 14/9, 2012 at 11:44 Comment(3)
I am aware of these options, but since there is no output to show, I would not expect to have to press enter.Sumter
@vext01 the options were just a guess, as I'm doesn't get any hit-enter prompt when I execute the steps you provided. Did you get anything on v:scrollstart?Aberrant
set cmdheight=2 seems to be the best thing I can do for now. Cheers!Sumter
R
7

Adding this line to ~/.vimrc seems to resolve the issue for me:

let g:netrw_silent = 1
Retardation answered 1/5, 2013 at 20:25 Comment(1)
When using the scp remote file editing, vim would prompt me. This, unlike the accepted answer, squelched that message.Cheese
R
5

I usually just do :e . to browse in current directory. Also, to get rid of prompts you can do :silent Exp.

Requirement answered 14/9, 2012 at 16:2 Comment(1)
smieszna ksywa :DSchild

© 2022 - 2024 — McMap. All rights reserved.