I am trying to add filetype plugin indent on to my vimrc, and I'm getting the error filetype: command not found. I tried searching but can't find a solution. I have the full vim package installed (not just tiny). Any ideas? Thanks!

(Ubuntu 20.10)


The error you are seeing looks more like a Bash error than a Vim error. For example, here is what I get when I run your command from Bash:

$ filetype plugin indent on
-bash: filetype: command not found

Note that error identifier (i.e., EXXX) characteristic of Vim error messages does not appear in the output. Here is what I get when I try to run an invalid command (e.g., :invalid) from Vim:

E492: Not an editor command: invalid

Looking through the Vim source we can see that if Vim produced such a message we would expect to see an E371 identifier. As a sanity check, from the How to debug my vimrc link that user D. Ben Knoble provided in his comment to your question, open Vim in a bare state:

vim -u NONE -U NONE -N

Then query the filetype option by executing the command :filetype. Here is the result on my machine:

filetype detection:OFF  plugin:OFF  indent:OFF

If this works, then it is a pretty good indication that the problem is stemming from your vimrc and the debugging article provided can guide you further along that process.

  • 1
    Indeed, perhaps OP mistakenly wrote source ~/.vimrc at a bash prompt instead of :source ~/.vimrc in vim – D. Ben Knoble Mar 22 at 16:18
  • Yes, sorry, I should have shared this here as I figured this out. It's been a while since I developed regularly, so I'm rediscovering these silly errors. :-/ Thanks for your detailed answer. I hope it helps someone else, as I searched all over and couldn't find a solution. – moinudin Mar 22 at 21:51

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