爱悠闲 > 查看vim 的启动过程。 确定自己vim 插件的存放位置

查看vim 的启动过程。 确定自己vim 插件的存放位置

分类: vim  |  作者: hejinjing_tom_com 相关  |  发布日期 : 2014-06-28  |  热度 : 312°

在mingw 下,有vim ,欲加入自己的plugin.

有两种方法, 1. 用vim -V 查看。 2. 用 set runtimepath? 来查看。 下面详述过程。

甲. 用vim -V 查看。

vim --help, 看到

-V[N][fname]         Be verbose [level N] [log messages to fname]

用下面命令也可以,默认verbose 是10。

vim -V 2>verbose

cat verbose.

chdir(/d/buffer)
chdir(/usr/share/vim)
chdir(/d/buffer)
sourcing "$VIM/vimrc"
finished sourcing $VIM/vimrc
chdir(/d/buffer)
chdir(/home/hjj)
chdir(/d/buffer)
sourcing "$HOME/.vimrc"
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/syntax)
chdir(/d/buffer)
line 9: sourcing "/usr/share/vim/vim73/syntax/syntax.vim"
Searching for "syntax/synload.vim" in "/home/hjj/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/home/hjj/.vim/after"
Searching for "/home/hjj/.vim/syntax/synload.vim"
Searching for "/usr/share/vim/vimfiles/syntax/synload.vim"
Searching for "/usr/share/vim/vim73/syntax/synload.vim"
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/syntax)
chdir(/d/buffer)
line 19: sourcing "/usr/share/vim/vim73/syntax/synload.vim"
Searching for "syntax/syncolor.vim" in "/home/hjj/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/home/hjj/.vim/after"
Searching for "/home/hjj/.vim/syntax/syncolor.vim"
Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
Searching for "/usr/share/vim/vim73/syntax/syncolor.vim"
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/syntax)
chdir(/d/buffer)
line 21: sourcing "/usr/share/vim/vim73/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim73/syntax/syncolor.vim
continuing in /usr/share/vim/vim73/syntax/synload.vim
Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
Searching for "/home/hjj/.vim/after/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim73/syntax/synload.vim
continuing in /usr/share/vim/vim73/syntax/syntax.vim
Searching for "filetype.vim" in "/home/hjj/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/home/hjj/.vim/after"
Searching for "/home/hjj/.vim/filetype.vim"
Searching for "/usr/share/vim/vimfiles/filetype.vim"
Searching for "/usr/share/vim/vim73/filetype.vim"
chdir(/d/buffer)
chdir(/usr/share/vim/vim73)
chdir(/d/buffer)
line 25: sourcing "/usr/share/vim/vim73/filetype.vim"
Searching for "ftdetect/*.vim" in "/home/hjj/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/home/hjj/.vim/after"
Searching for "/home/hjj/.vim/ftdetect/*.vim"
Searching for "/usr/share/vim/vimfiles/ftdetect/*.vim"
Searching for "/usr/share/vim/vim73/ftdetect/*.vim"
Searching for "/usr/share/vim/vimfiles/after/ftdetect/*.vim"
Searching for "/home/hjj/.vim/after/ftdetect/*.vim"
not found in 'runtimepath': "ftdetect/*.vim"
finished sourcing /usr/share/vim/vim73/filetype.vim
continuing in /usr/share/vim/vim73/syntax/syntax.vim
Searching for "/usr/share/vim/vimfiles/after/filetype.vim"
Searching for "/home/hjj/.vim/after/filetype.vim"
finished sourcing /usr/share/vim/vim73/syntax/syntax.vim
continuing in /home/hjj/.vimrc
finished sourcing $HOME/.vimrc
Searching for "plugin/**/*.vim" in "/home/hjj/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,/home/hjj/.vim/after"
Searching for "/home/hjj/.vim/plugin/**/*.vim"
Searching for "/usr/share/vim/vimfiles/plugin/**/*.vim"
Searching for "/usr/share/vim/vim73/plugin/**/*.vim"
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/getscriptPlugin.vim"
finished sourcing /usr/share/vim/vim73/plugin/getscriptPlugin.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/gzip.vim"
finished sourcing /usr/share/vim/vim73/plugin/gzip.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/matchparen.vim"
finished sourcing /usr/share/vim/vim73/plugin/matchparen.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/netrwPlugin.vim"
finished sourcing /usr/share/vim/vim73/plugin/netrwPlugin.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/rrhelper.vim"
finished sourcing /usr/share/vim/vim73/plugin/rrhelper.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/spellfile.vim"
finished sourcing /usr/share/vim/vim73/plugin/spellfile.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/tarPlugin.vim"
finished sourcing /usr/share/vim/vim73/plugin/tarPlugin.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/tohtml.vim"
finished sourcing /usr/share/vim/vim73/plugin/tohtml.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/vimballPlugin.vim"
finished sourcing /usr/share/vim/vim73/plugin/vimballPlugin.vim
chdir(/d/buffer)
chdir(/usr/share/vim/vim73/plugin)
chdir(/d/buffer)
sourcing "/usr/share/vim/vim73/plugin/zipPlugin.vim"
finished sourcing /usr/share/vim/vim73/plugin/zipPlugin.vim
Searching for "/usr/share/vim/vimfiles/after/plugin/**/*.vim"
Searching for "/home/hjj/.vim/after/plugin/**/*.vim"
Reading viminfo file "/home/hjj/.viminfo" info oldfiles
Press ENTER or type command to continue

启动完之后,看看加载后的结果:

scriptnames:

 1: /usr/share/vim/vimrc
 2: /home/hjj/.vimrc
 3: /usr/share/vim/vim73/syntax/syntax.vim
 4: /usr/share/vim/vim73/syntax/synload.vim
 5: /usr/share/vim/vim73/syntax/syncolor.vim
 6: /usr/share/vim/vim73/filetype.vim
 7: /usr/share/vim/vim73/plugin/getscriptPlugin.vim
 8: /usr/share/vim/vim73/plugin/gzip.vim
 9: /usr/share/vim/vim73/plugin/matchparen.vim
10: /usr/share/vim/vim73/plugin/netrwPlugin.vim
11: /usr/share/vim/vim73/plugin/rrhelper.vim
12: /usr/share/vim/vim73/plugin/spellfile.vim
13: /usr/share/vim/vim73/plugin/tarPlugin.vim
14: /usr/share/vim/vim73/plugin/tohtml.vim
15: /usr/share/vim/vim73/plugin/vimballPlugin.vim
16: /usr/share/vim/vim73/plugin/zipPlugin.vim


于是确定,自己的vimfiles 加载的位置放置于 .vim/plugin 目录下, 实现功能扩展。且不影响系统功能。

操作:

1. 在家目录下,创建.vim 目录

2. 在.vim 目录下,创建plugin 目录。

3. 将自己的插件copy 与此。

4. 用scriptnames, 查看结果。


乙: 用runtimepath 来查看。

runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,~/.vim/after

简单明了, 就是vim 的运行查找路径