为什么这个vim插件没有加载?

时间:2017-05-20 00:19:32

标签: vim pathogen

我正在使用pathogen构建一个插件包来管理我的博客。对于初学者,我想要将我在vimrc中直接定义的一些命令分解出来并将它们移动到插件中。以下是我设置捆绑包的方法:

call pathogen#infect('/home/frew/code/blog/etc/vim-bundle/{}')

以下是插件开头的简短摘录:

echom "loaded hugo plugin"
if exists('g:loaded_hugo') || &cp || v:version < 700
  finish
endif
let g:loaded_hugo = 1

function! Tagged(tag)
  exe 'args `bin/tag-files ' . a:tag . '`'
endfunction
command! -nargs=1 Tagged call Tagged('<args>')

这是捆绑包的目录结构:

/home/frew/code/blog/etc/vim-bundle/
└── hugo
    └── plugin
        └── hugo.vim

2 directories, 1 file

echom永远不会运行,而且我还是gvim,我发现匹配/home/frew/code/blog/etc/vim-bundle/ :(我用sort -u过滤了重复项)

open("/home/frew/code/blog/etc/vim-bundle/hugo/ftdetect/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/html/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/markdown/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/markdown/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC <unfinished ...>
open("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC <unfinished ...>
open("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/vim/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/markdown/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/vim/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/vim/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC <unfinished ...>
open("/home/frew/code/blog/etc/vim-bundle/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 18
stat("/home/frew/code/blog/etc/vim-bundle/hugo/after", 0x7fffd759c6d0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/autoload/ctrlp/utils.vim", 0x7fffd759a620) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/autoload/editorconfig.vim", 0x7fffd759c650) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/autoload/gitgutter/async.vim", 0x7fffd759d2f0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/autoload/gitgutter/debug.vim",  <unfinished ...>
stat("/home/frew/code/blog/etc/vim-bundle/hugo/autoload/gitgutter/diff.vim", 0x7fffd759e6d0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/autoload/gitgutter/sign.vim", 0x7fffd75a0040) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/autoload/htmlcomplete.vim", 0x7fffd759c4c0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/filetype.vim", 0x7fffd759f830) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftoff.vim", 0x7fffd759f830) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/html.vim", 0x7fffd759cf40) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/html.vim", 0x7fffd759d050) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/html.vim", 0x7fffd759d270) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/markdown.vim", 0x7fffd759da70) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/markdown.vim", 0x7fffd759dda0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/markdown.vim",  <unfinished ...>
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/vim.vim", 0x7fffd759e6e0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/vim.vim", 0x7fffd759e830) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/ftplugin/vim.vim",  <unfinished ...>
stat("/home/frew/code/blog/etc/vim-bundle/hugo/indent/markdown.vim", 0x7fffd759da70) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/indent/markdown.vim", 0x7fffd759db80) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/indent/markdown.vim", 0x7fffd759dda0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/indent/vim.vim", 0x7fffd759e830) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/indent/vim.vim",  <unfinished ...>
stat("/home/frew/code/blog/etc/vim-bundle/hugo/scripts.vim", 0x7fffd75a0060) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo", {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/css.vim", 0x7fffd759ae20) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/css.vim", 0x7fffd759af30) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/css.vim", 0x7fffd759b150) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/html.vim", 0x7fffd759b9e0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/html.vim", 0x7fffd759baf0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/html.vim", 0x7fffd759bd10) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/javascript.vim", 0x7fffd759ae20) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/javascript.vim", 0x7fffd759af30) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/javascript.vim", 0x7fffd759b150) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/markdown.vim", 0x7fffd759c510) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/markdown.vim", 0x7fffd759c620) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/markdown.vim", 0x7fffd759c840) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/pod.vim", 0x7fffd759b230) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/pod.vim", 0x7fffd759b380) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/vb.vim", 0x7fffd759ae20) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/vb.vim", 0x7fffd759af30) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/vb.vim", 0x7fffd759b150) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/vim.vim", 0x7fffd759d2d0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/syntax/vim.vim",  <unfinished ...>
stat("/home/frew/code/blog/etc/vim-bundle/hugo/vimfiles", 0x7fffd759cce0) = -1 ENOENT (No such file or directory)
stat("/home/frew/code/blog/etc/vim-bundle/hugo/vimfiles/after", 0x7fffd759c750) = -1 ENOENT (No such file or directory)

显然它找到了hugo插件目录,它甚至从未尝试查找相关的plugin子目录。

我在这里缺少什么?

更新:以下是&rtp

的当前值
/home/frew/code/blog/etc/vim-bundle/hugo,/home/frew/.vim,/home/frew/.vim/bundle-lua/neocomplete,/home/frew/.vim/
bundle-python/editorconfig,/home/frew/.vim/bundle-python/ultisnips,/home/frew/.vim/bundle/FastFold,/home/frew/.v
im/bundle/IndentAnything,/home/frew/.vim/bundle/airline,/home/frew/.vim/bundle/better-whitespace,/home/frew/.vim
/bundle/colors-solarized,/home/frew/.vim/bundle/commentary,/home/frew/.vim/bundle/csv,/home/frew/.vim/bundle/ctr
lp,/home/frew/.vim/bundle/denite,/home/frew/.vim/bundle/eunuch,/home/frew/.vim/bundle/exchange,/home/frew/.vim/b
undle/fugitive,/home/frew/.vim/bundle/fugitive-gitlab,/home/frew/.vim/bundle/gitgutter,/home/frew/.vim/bundle/go
,/home/frew/.vim/bundle/goyo,/home/frew/.vim/bundle/inkpot,/home/frew/.vim/bundle/l9,/home/frew/.vim/bundle/last
place,/home/frew/.vim/bundle/lost,/home/frew/.vim/bundle/matchit,/home/frew/.vim/bundle/matchmaker,/home/frew/.v
im/bundle/obsession,/home/frew/.vim/bundle/pathogen,/home/frew/.vim/bundle/perl,/home/frew/.vim/bundle/projectio
nist,/home/frew/.vim/bundle/python,/home/frew/.vim/bundle/quick-scope,/home/frew/.vim/bundle/repeat,/home/frew/.
vim/bundle/sleuth,/home/frew/.vim/bundle/splitjoin,/home/frew/.vim/bundle/surround,/home/frew/.vim/bundle/tabula
r,/home/frew/.vim/bundle/terminus,/home/frew/.vim/bundle/textobj-between,/home/frew/.vim/bundle/textobj-entire,/
home/frew/.vim/bundle/textobj-underscore,/home/frew/.vim/bundle/textobj-user,/home/frew/.vim/bundle/unimpaired,/
home/frew/.vim/bundle/vinegar,/home/frew/.vim/bundle/visual-star-search,/home/frew/.vim/bundle/wipeout,/var/lib/
vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim80,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,
/home/frew/.vim/bundle/tabular/after,/home/frew/.vim/bundle-python/ultisnips/after,/home/frew/.vim/after

1 个答案:

答案 0 :(得分:0)

Tim Pope在github上回答了这个问题。插件会在会话之前加载,因此如果要加载插件,在会话时修改&rtp为时已晚。