もた日記

くだらないことを真面目にやる

Vimメモ : Vimをデフォルトの設定で起動する

たまにVimをデフォルトの設定で起動して動作を確認したいときがあるが、いつも方法を忘れるのでメモ。
下記オプションを設定して起動すればよい。

$ vim -u NONE -N


ヘルプによると、NONEはvimrcファイルとプラグインを読み込まないようにする。NORCという設定もあり、これはvimrcファイルは読み込まないがプラグインは読み込むらしい。
-u NONEを指定すると、Vi互換モード(compatible)になり便利な機能が使えなくなるためこれを防ぐために-Nを指定してVi非互換モードにする。

                                                        -u E282
-u {vimrc}      The file {vimrc} is read for initializations.  Most other
                initializations are skipped; see initialization.  This can
                be used to start Vim in a special mode, with special
                mappings and settings.  A shell alias can be used to make
                this easy to use.  For example:
                        alias vimc vim -u ~/.c_vimrc !*
                Also consider using autocommands; see autocommand.
                When {vimrc} is equal to "NONE" (all uppercase), all
                initializations from files and environment variables are
                skipped, including reading the gvimrc file when the GUI
                starts.  Loading plugins is also skipped.
                When {vimrc} is equal to "NORC" (all uppercase), this has the
                same effect as "NONE", but loading plugins is not skipped.
                Using the "-u" argument has the side effect that the
                'compatible' option will be on by default.  This can have
                unexpected effects.  See 'compatible'.
                {not in Vi}


読み込むvimrcファイルのパスを指定して起動したければ、以下のようにパスを指定して起動する。

$ vim -u <vimrcのパス>

実践Vim 思考のスピードで編集しよう!

実践Vim 思考のスピードで編集しよう!