1

Background

I've been using Linux for years now and my daily driver is Debian Jessie. I have been using vim for about 2 years but my vim skills are sub-optimal (I still really only use the basics).

I've decided that I want to improve my vim usage and I recently read a suggestion that before you start with anything too advanced, get to know the vimtutor inside out (complete it daily for at least a week).

However vim tutor doesn't work. I recall this issue when I first started with vim and just manually copied the tutor file. My guess is that it's to do with something I "configured" before I knew what I was doing. But I'd like to fix it now if I'm going to be doing it daily.

The Problem

Here's the error I get (within vim) when I run vimtutor:

"$VIMRUNTIME/tutor/tutor.vim" [New DIRECTORY]
Error detected while processing command line:
E471: Argument required
Press ENTER or type command to continue

Pressing enter just leaves me editing an empty file. If I try to quit out of that (:q) I get:

"nocp" [New File]
--- Options ---
noloadplugins         scroll=16
Press ENTER or type command to continue

Again enter leaves me in an empty file. Quit again gives me:

E173: 1 more file to edit

And quit a 3rd time takes me back to the command line...!?

What I've tried:

  • checking out ln 471 of /usr/share/vim/vim74/tutor/tutor.vim: only goes to line 200 so the offending line must be somewhere else?!
  • reinstalling vim & vim-gtk (apt-get install --reinstall vim vim-gtk)
  • purging vim-tiny (it wasn't installed).

Further info

The last few lines of the vimtutor script (/usr/bin/vimtutor) are:

# Use Vim to copy the tutor, it knows the value of $VIMRUNTIME
# The script tutor.vim tells Vim which file to copy
$VIM -f -u NONE -c 'so $VIMRUNTIME/tutor/tutor.vim'

# Start vim without any .vimrc, set 'nocompatible'
$VIM -f -u NONE -c "set nocp" $TUTORCOPY
4
  • That's weird. The vimtutor script is behaving as though the quotes have been removed from the last few commands. E471 means error number 471, not an error at line 471. You can find a little more about it with :help E471, assuming the help files in your installation work. Look at the last two commands in the vimtutor script. If there were no quotes in -c "so $VIMRUNTIME/tutor/tutor.vim", vim would try to execute the :so command without an argument, which would give you E471, and would try to open a file named $VIMRUNTIME/tutor/tutor.vim, which it can't find, probably because...
    – garyjohn
    Nov 29 '16 at 4:37
  • ... $VIMRUNTIME is being expanded by the shell instead of by vim and is empty. If there were no quotes in the next command, -c "set nocp" would be interpreted as the command :set, which would output the --- Options --- stuff, then try to open a file named nocp. The 1 more file to edit is due to vim thinking it has two file arguments, nocp and $TUTORCOPY. That's what seems to be happening, but I can't tell you why.
    – garyjohn
    Nov 29 '16 at 4:42
  • @garyjohn - thanks for your input. I should have realised that E471 was Error 471 - Doh! I have edited my question to include the last few lines of my vimtutor script. FWIW I tried manually launching vim -f -u NONE -c 'so $VIMRUNTIME/tutor/tutor.vim' and get a different albeit similar error (in vim): "$VIMRUNTIME/tutor/tutor.vim" [New DIRECTORY] Error detected while processing command line: E471: Argument required Nov 29 '16 at 5:12
  • 1
    Whilst you didn't explicitly resolve the issue for me, you gave me enough info to discover the issue! I discovered that I had a /usr/local/bin/vim script. I don't recall it's purpose but it seems that was the culprit. The script was calling vim like this: /usr/bin/vim $@. I assume that would be the cause of the shell expanding $VIMRUNTIME. I removed that and now it works! Thanks again! :) Nov 29 '16 at 5:29
2

As noted as a comment, the problem was that I had a /usr/local/bin/vim script which was calling vim without quoting the arguments. So as pointed out by @garyjohn the bash expanded $VIMRUNTIME would have been empty.

Random local vim script removed and all is now well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.