Your question really boils down to:
Why is my custom command :MyCommand
working fine when I start Vim normally and not when I start Vim with -u NONE
?
A question that will be difficult to answer without seeing the relevant code.
Anyway, when you start Vim with -u NONE
, you tell it to act like vi, which it will happily do by, among other things, setting :help 'compatible'
, which in turns sets and resets a whole lot of options and default behaviors and makes Vim nearly unusable unless you know vi very well.
Note that the above is just a rehash of the following paragraph, under :help -u
:
Using the "-u" argument with another argument than DEFAULTS
has the side effect that the 'compatible' option will be on by
default. This can have unexpected effects. See
|'compatible'|.
Which leads you to :help 'compatible'
(and then :help 'cpoptions'
), where you can get a good idea of all the damage it does.
If your custom command relies on one or more of those options to be set in a different way than what set compatible
does, then it is very likely to break in unpredictable ways.
Adding set nocompatible
to your script would be the first thing to try.
Also, unless you are very comfortable with vi or you are debugging things by establishing an unrealistically low baseline, starting Vim with -u NONE
is generally pointless. -Nu NONE
or --clean
would be more useful. The former because it starts Vim with nocompatible
, the latter because it mimics the out-of-the-box experience.
In short: you are using -u NONE
without understanding what it does and, when things go sideways, you have no idea where to look at. It is a shame to treat Vim like a black box when it is the text editor with the best documentation ever.
vimrc
? What makes you say thatmyplugin
is a "ftplugin"? It looks like a regular plugin to me.echo exists(':MyCommand')
returns2
? Btw, it is the current folder.ftplugin
loading but something else. With the information we have I don't know how to help :-|