Vimrc: When backupdir is installed, every save prompt "press enter to continue"

When I add the following line to my .vimrc:

set backupdir=~/.vim/backup

      

I get the following prompt every time I save the file with: w:

Press ENTER or type command to continue

      

which quickly becomes a pain. (Edit) Also, there is actually nothing displayed other than this prompt (i.e. no new information).

Notes:

  • The request seems to be independent of whether I have "set directory" or "set backup" in vimrc.
  • I don't get an error if I edit a file that is in my home directory, for example ~ / .vimrc.
  • Yes, the folder exists and the backup files are stored there successfully:

    $ ls ~ / .vim / backup

    test ~ test.txt ~

  • (Edit) Changing cmdheight to 3 or more makes the command line disappear. However, it does not fix the main problem - there is no additional text here (just "test.txt" 10L, 255C written "), so I don't know what error, if any, occurs.

  • (Edit) I get this prompt even if I comment out everything in my .vimrc file except set backupdir = ~ / .vim / backup. I have no plugins.

Can I stop this message from appearing, but keep my backup directory? Thanks for any advice!

+3


source to share


3 answers


From VIM Documentation ,

Press ENTER or enter a command to continue

This message is provided when there is read something on the screen and the screen is about to be redrawn: - After executing an external command (for example, ":! Ls" and "="). - Something is displayed in a status bar that is longer than the width of the window, or triggered in the "showcmd" or "ruler" output.

So vim is trying to tell you something, some kind of error message or whatever, and your cmd window height is not enough and hence will prompt you with a message

To overcome this, the documentation suggests



To reduce the number of I / O requests:

  • Set 'cmdheight' to 2 or higher.

  • Add flags to "shortmess".

  • Reset 'showcmd' and / or 'ruler.

I suggest you check what vim error is being thrown before trying to resolve the prompt.

You can also read this

+1


source


I haven't figured out the answer to this question yet.



The odd data point is that this conflict only appears to be true when my backup directory is in my home folder (or ~ / .vim / backup or?). By installing it in a different folder, you will encounter a mystery error.

+1


source


try this:

  if !isdirectory(expand("~/.vim/backupdir/"))
    silent !echo "Creating backup dir..."
    silent !mkdir -p ~/.vim/backupdir
  endif
  if !isdirectory(expand("~/.vim/swap/"))
    silent !echo "Creating swap dir..."
    silent !mkdir -p ~/.vim/swap
  endif
  if !isdirectory(expand("~/.vim/undo/"))
    silent !echo "Creating undo dir..."
    silent !mkdir -p ~/.vim/undo
  endif

  set backupdir^=~/.vim/backup//              " where to put backup files
  set directory^=~/.vim/swap//                " where to put swap files
  set undodir^=~/.vim/undo//                  " where to put undo files

      

+1


source







All Articles