无法在Ubuntu trusty64上加载Vim插件

时间:2014-09-22 08:41:55

标签: linux ubuntu vim vim-plugin

我正在使用Vagrant和VirtualBox来设置和配置Ubuntu Trusty计算机。在配置阶段,我正在下载我的dotfiles(包括我的.vimrc.tmux.conf文件以及我的.vim文件夹。

我的.tmux.conf工作正常,但我发现我的.vimrc无法加载我的插件(我使用Pathogen插件管理器),因此当我启动Vim时,我看到某些配色方案的错误没有找到(因为特定的配色方案是通过插件加载的),而且.vimrc中的其他一些与插件相关的设置也会导致显示错误。

下面是我的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

完整的配置脚本可以在这里查看:https://github.com/Integralist/Linux-and-Docker-Development-Environment/blob/master/provision.sh但重要的部分(即我的dotfiles的git克隆和签出相关的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) ..

在上面的代码片段中,我将所有的dotfiles(即.vimrc.vim.tmux.conf)移动到/home/vagrant/(注意:括号内指定的文件不是不过像.git文件夹那样被移动了。

当我执行vim时,我收到以下错误:

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

然后在Vim内再次出现错误:

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

我已经查看了关于病原体回购的其他Linux相关问题,但我无法确定问题的来源?

执行: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

执行: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

执行:set compatible?会返回nocompatible

执行:set loadplugins?会返回loadplugins

查看:scriptnames输出似乎可能在病原体文件之前加载了.vimrc?但如果是这样的话,我不知道如何解决这个问题,所以它总是首先加载?我在GitHub上与Tim Pope(Pathogen的作者)谈过这个问题,他建议:

  

“加载pathogen.vim是你vimrc的工作,所以排序是正确的。确认你是如何调用病原体和你的Vim目录的目录结构”

然后我回答了以下澄清(注意:我没有回复,所以我现在在这里寻求帮助)......

我的完整dotfile结构可以在这里看到:https://github.com/Integralist/dotfiles(技术上它是linux分支)。

具体来说,我在这里称之为:https://github.com/Integralist/dotfiles/blob/linux/.vimrc#L119-L120

注意:这些dotfiles在我的Mac上工作正常,只是因为在Linux机器上加载它们我发现插件没有被Pathogen加载的问题。

顶级树结构可以在下面看到......

.
├── .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

我已经尝试删除bundle目录中的所有插件并放回tomorrow-night-vim插件文件夹但仍然无法找到插件,因此当我执行:colorscheme Tomorrow时无法找到该文件(这是希望可能有另一个插件导致问题,并阻止所有其他插件加载 - >抓住我知道的那个吸管)。

以下输出来自我在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

1 个答案:

答案 0 :(得分:0)

所以看起来问题不在于病原体,而在于Git并且它没有提交我的子模块。显然有一种方法可以使用.gitmodules文件解决这个问题,但我没有时间进一步调查它,所以我使用一些基本的Unix命令解决了这个问题:

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

然后我能够提交子模块文件夹的内容