简体   繁体   English

无法在Ubuntu Trusty64上加载Vim插件

[英]Unable to load Vim plugins on Ubuntu trusty64

I'm using Vagrant and VirtualBox to set-up and provision a Ubuntu Trusty machine. 我正在使用Vagrant和VirtualBox设置和配置Ubuntu Trusty计算机。 During the provisioning stage I'm downloading my dotfiles (which include my .vimrc and .tmux.conf files as well as my .vim folder). 在供应阶段,我正在下载我的dotfile(包括.vimrc.tmux.conf文件以及.vim文件夹)。

My .tmux.conf works fine but I discovered that my .vimrc was failing to load my plugins (I use the Pathogen plugin manager) and so when I start Vim I see errors about certain colour schemes not being found (because the particular colour scheme is loaded via a plugin) and also some other plugin related settings within my .vimrc are causing errors to be displayed. 我的.tmux.conf工作正常,但是我发现.vimrc无法加载我的插件(我使用了Pathogen插件管理器),因此,当我启动Vim时,我看到找不到关于某些配色方案的错误(因为特定的配色方案)是通过插件加载的),而且.vimrc中的一些其他与插件相关的设置也导致显示错误。

Below is my Vagrantfile (not that it's relevant but in case you're wondering what box I'm using to up the Linux instance from): 以下是我的Vagrantfile (不是很重要),以防万一您想知道我要使用哪个框来启动Linux实例):

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.network :private_network, ip: "172.17.8.100"
  config.vm.synced_folder "./Application", "/www", create: true

  config.vm.provision "shell" do |s|
    s.privileged = true
    s.path = "provision.sh"
  end

  config.ssh.forward_agent = true
  config.ssh.forward_x11 = true
end

The full provisioning script can be viewed here: https://github.com/Integralist/Linux-and-Docker-Development-Environment/blob/master/provision.sh but the important section (ie the git cloning of my dotfiles and checking out the relevant linux branch) is as follows: 完整的配置脚本可以在这里查看: https : //github.com/Integralist/Linux-and-Docker-Development-Environment/blob/master/provision.sh但重要的部分(即git克隆我的dotfile和检查列出相关的linux分支),如下所示:

dotfiles_location=/home/vagrant/dotfiles
git clone https://github.com/Integralist/dotfiles.git $dotfiles_location
cd $dotfiles_location && git fetch && git checkout linux
shopt -s extglob
mv !(.|..|.git|README.md) ..

In the above snippet I'm moving all the dotfiles (ie .vimrc , .vim and .tmux.conf ) into /home/vagrant/ (note: the files specified inside the parentheses aren't being moved though, like the .git folder). 在上面的代码片段中,我将所有点文件(即.vimrc.vim.tmux.conf )移到/home/vagrant/ (注意:括号内指定的文件不会被移动,例如.git夹)。

When I execute vim I get the following error: 当我执行vim ,出现以下错误:

Error detected while processing /home/vagrant/.vimrc:
line  125:
E185: Cannot find color scheme 'Tomorrow-Night'

And then within Vim it errors again: 然后在Vim中再次出错:

Error detected while processing VimEnter Auto commands for "*":
E492: Not an editor command: RainbowParenthesesToggle

I've looked at other Linux related issues on the Pathogen repo but I can't determine where the problem is coming from? 我在“病原体”仓库中查看了其他与Linux相关的问题,但是我无法确定问题的根源是什么?

Executing :scriptnames returns: 执行:scriptnames返回:

  1: /usr/share/vim/vimrc
  2: /usr/share/vim/vim74/debian.vim
  3: /usr/share/vim/vim74/syntax/syntax.vim
  4: /usr/share/vim/vim74/syntax/synload.vim
  5: /usr/share/vim/vim74/syntax/syncolor.vim
  6: /usr/share/vim/vim74/filetype.vim
  7: ~/.vimrc
  8: /usr/share/vim/vim74/syntax/nosyntax.vim
  9: ~/.vim/autoload/pathogen.vim
 10: /usr/share/vim/vim74/ftoff.vim
 11: /usr/share/vim/vim74/ftplugin.vim
 12: /usr/share/vim/vim74/indent.vim
 13: ~/.vim/plugin/BufOnly.vim
 14: ~/.vim/plugin/scratch.vim
 15: ~/.vim/bundle/ZoomWin/plugin/ZoomWinPlugin.vim
 16: /usr/share/vim/vim74/plugin/getscriptPlugin.vim
 17: /usr/share/vim/vim74/plugin/gzip.vim
 18: /usr/share/vim/vim74/plugin/matchparen.vim
 19: /usr/share/vim/vim74/plugin/netrwPlugin.vim
 20: /usr/share/vim/vim74/plugin/rrhelper.vim
 21: /usr/share/vim/vim74/plugin/spellfile.vim
 22: /usr/share/vim/vim74/plugin/tarPlugin.vim
 23: /usr/share/vim/vim74/plugin/tohtml.vim
 24: /usr/share/vim/vim74/plugin/vimballPlugin.vim
 25: /usr/share/vim/vim74/plugin/zipPlugin.vim

Executing :set rtp returns: 执行:set rtp返回:

runtimepath=
~/.vim,
/var/lib/vim/addons,
/usr/share/vim/vimfiles,
/usr/share/vim/vim74,
/usr/share/vim/vimfiles/after,
/var/lib/vim/addons/after,
~/.vim/after

Executing :set compatible? 执行:set compatible? returns nocompatible 返回不nocompatible

Executing :set loadplugins? 正在执行:set loadplugins? returns loadplugins 返回loadplugins

Looking at the :scriptnames output it seems like maybe the .vimrc is being loaded before the pathogen file? 查看:scriptnames输出,似乎是在病原体文件之前加载了.vimrc吗? But if that's the case I'm not sure how to resolve that so it's always loaded first? 但是,如果是这种情况,我不确定如何解决该问题,那么它总是首先加载吗? I spoke with Tim Pope (author of Pathogen) on GitHub about it and he suggested: 我在GitHub上与Tim Pope(Pathogen的作者)进行了交谈,他建议:

"It's your vimrc's job to load pathogen.vim so the ordering is correct. Confirm how you're invoking pathogen and the directory structure of your Vim directory" “加载virtario.vim是您的vimrc的工作,因此顺序是正确的。请确认您如何调用病原体和Vim目录的目录结构”

I then replied with the following clarification (Note: I heard nothing back, hence I'm now here looking for help)... 然后,我回答了以下问题(注意:我什么也没听到,因此我现在在这里寻求帮助)...

My full dotfile structure can be seen here: https://github.com/Integralist/dotfiles (technically it's the linux branch). 我的完整dotfile结构可以在这里看到: https : //github.com/Integralist/dotfiles (从技术上讲,这是linux分支)。

Specifically I call it here: https://github.com/Integralist/dotfiles/blob/linux/.vimrc#L119-L120 具体来说,我在这里称呼它: https : //github.com/Integralist/dotfiles/blob/linux/.vimrc#L119-L120

Note: these dotfiles work fine on my Mac and it's only since loading them on a Linux machine have I noticed an issue with plugins not being loaded by Pathogen. 注意:这些dotfile在我的Mac上运行良好,仅是因为将它们加载到Linux机器上之后,我才注意到Pathogen无法加载插件的问题。

The top level tree structure can be seen below... 顶级树形结构可以在下面看到...

.
├── .agignore
├── .bashrc
├── .gitconfig
├── .gitignore_global
├── .irssi
├── .tmux.conf
├── .vim
│   ├── .netrwhist
│   ├── autoload
│   │   └── pathogen.vim
│   ├── bundle
│   │   ├── CSApprox
│   │   ├── Dockerfile.vim
│   │   ├── Gist.vim
│   │   ├── Tabmerge
│   │   ├── ZoomWin
│   │   ├── ack.vim
│   │   ├── camelcasemotion
│   │   ├── ctrlp.vim
│   │   ├── emmet-vim
│   │   ├── gruvbox
│   │   ├── html5.vim
│   │   ├── nerdtree
│   │   ├── rainbow_parentheses.vim
│   │   ├── supertab
│   │   ├── syntastic
│   │   ├── tabular
│   │   ├── targets.vim
│   │   ├── textutil.vim
│   │   ├── tomorrow-night-vim
│   │   ├── vim-airline
│   │   ├── vim-bookmarks
│   │   ├── vim-choosewin
│   │   ├── vim-clojure-highlight
│   │   ├── vim-clojure-static
│   │   ├── vim-colors-pencil
│   │   ├── vim-commentary
│   │   ├── vim-cucumber
│   │   ├── vim-dispatch
│   │   ├── vim-endwise
│   │   ├── vim-fireplace
│   │   ├── vim-fugitive
│   │   ├── vim-gitgutter
│   │   ├── vim-haml
│   │   ├── vim-leiningen
│   │   ├── vim-localrc
│   │   ├── vim-markdown
│   │   ├── vim-node
│   │   ├── vim-polyglot
│   │   ├── vim-repeat
│   │   ├── vim-ruby
│   │   ├── vim-sexp
│   │   ├── vim-sexp-mappings-for-regular-people
│   │   ├── vim-surround
│   │   ├── vim-tbone
│   │   ├── webapi-vim
│   │   └── wildfire.vim
│   ├── colors
│   │   ├── Tomorrow-Solarized.vim
│   │   ├── badwolf.vim
│   │   ├── blazer.vim
│   │   ├── flatland.vim
│   │   ├── github.vim
│   │   ├── gruvbox.vim
│   │   ├── kellys.vim
│   │   ├── vividchalk.vim
│   │   └── whitebox.vim
│   └── plugin
│       ├── BufOnly.vim
│       └── scratch.vim
├── .vimrc

I've since tried deleting all plugins from the bundle directory and putting back in the tomorrow-night-vim plugin folder but still Vim can't find the plugin so when I execute :colorscheme Tomorrow it fails to locate that file (this was in the hope that maybe there was another plugin that was causing a problem and stopping all other plugins from loading -> clutching at straws on that one I know). 从那以后,我尝试从bundle目录中删除所有插件,然后放回到tomorrow-night-vim插件文件夹中,但是Vim仍然找不到该插件,所以当我执行:colorscheme Tomorrow它无法找到该文件(该文件位于希望可能还有另一个插件引起了问题,并阻止了其他所有插件的加载->抓住那个我知道的吸管)。

The following output is from running :scriptnames on a similar set-up on my Mac: 以下输出来自在Mac上类似设置上运行的:scriptnames

~/.vimrc
  2: /usr/local/Cellar/vim/7.4.335/share/vim/vim74/syntax/syntax.vim
  3: /usr/local/Cellar/vim/7.4.335/share/vim/vim74/syntax/synload.vim
  4: /usr/local/Cellar/vim/7.4.335/share/vim/vim74/syntax/syncolor.vim
  5: /usr/local/Cellar/vim/7.4.335/share/vim/vim74/filetype.vim
  6: ~/.vim/autoload/pathogen.vim
  7: /usr/local/Cellar/vim/7.4.335/share/vim/vim74/ftoff.vim
  8: ~/.vim/bundle/Dockerfile.vim/ftdetect/Dockerfile.vim
  9: ~/.vim/bundle/vim-clojure-static/ftdetect/clojure.vim
 10: ~/.vim/bundle/vim-cucumber/ftdetect/cucumber.vim
 11: ~/.vim/bundle/vim-haml/ftdetect/haml.vim
 12: ~/.vim/bundle/vim-markdown/ftdetect/markdown.vim
 13: ~/.vim/bundle/vim-node/ftdetect/node.vim
 14: ~/.vim/bundle/vim-polyglot/ftdetect/polyglot.vim
 15: ~/.vim/bundle/vim-ruby/ftdetect/ruby.vim
 16: ~/.vim/bundle/vim-polyglot/after/ftdetect/rspec.vim
 17: /usr/local/Cellar/vim/7.4.335/share/vim/vim74/ftplugin.vim
 18: /usr/local/Cellar/vim/7.4.335/share/vim/vim74/indent.vim
 19: ~/.vim/bundle/tomorrow-night-vim/colors/Tomorrow-Night.vim
 20: ~/.vim/plugin/BufOnly.vim
 21: ~/.vim/plugin/scratch.vim
 22: ~/.vim/bundle/ack.vim/plugin/ack.vim
 23: ~/.vim/bundle/camelcasemotion/plugin/camelcasemotion.vim
 24: ~/.vim/bundle/CSApprox/plugin/CSApprox.vim
 25: ~/.vim/bundle/ctrlp.vim/plugin/ctrlp.vim
 26: ~/.vim/bundle/ctrlp.vim/autoload/ctrlp/mrufiles.vim
 27: ~/.vim/bundle/emmet-vim/plugin/emmet.vim
 28: ~/.vim/bundle/Gist.vim/plugin/gist.vim
 29: ~/.vim/bundle/nerdtree/plugin/NERD_tree.vim
 30: ~/.vim/bundle/nerdtree/autoload/nerdtree.vim
 31: ~/.vim/bundle/nerdtree/lib/nerdtree/path.vim
 32: ~/.vim/bundle/nerdtree/lib/nerdtree/menu_controller.vim

So it seems the problem wasn't with Pathogen but with Git and it not committing my submodules. 因此,问题似乎不在于Pathogen,而是Git,而且它没有提交我的子模块。 Apparently there is a way to work around this using a .gitmodules file but I didn't have time to investigate it further so I solved the problem using some basic Unix commands: 显然,可以使用.gitmodules文件来解决此问题,但是我没有时间进一步研究它,因此我使用一些基本的Unix命令解决了该问题:

find . -type d -name '.git' | xargs rm -rf

I then was able to commit the contents of the submodule folders 然后,我能够提交子模块文件夹的内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM