我正在使用Vagrant和VirtualBox来设置和提供一个Ubuntu可靠的机器。在供应阶段,我正在下载我的dotfile(其中包括我的.vimrc和.tmux.conf文件以及我的.vim文件夹)。
我的.tmux.conf运行良好,但我发现我的.vimrc未能加载我的插件(我使用病原体插件管理器),所以当我启动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,但是重要的部分(即对我的dotfile进行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) ..在上面的片段中,我将所有的dotfile(即.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上采访了蒂姆·波普(“病原体”一书的作者),他建议:
加载pathogen.vim是您的工作,所以顺序是正确的。确认您是如何调用病原体和Vim目录的目录结构的
然后我作了如下澄清(注:我没有收到任何回音,因此我现在在这里寻求帮助).
我的完整的dotfile结构可以在这里看到:https://github.com/Integralist/dotfiles (从技术上讲,它是linux分支)。
具体来说,我在这里称之为:https://github.com/Integralist/dotfiles/blob/linux/.vimrc#L119-L120
注意:这些点文件在我的Mac上运行良好,只是在将它们加载到Linux机器上之后,我才注意到插件没有被病原体加载的问题。
顶部的树结构可以看到下面..。
.
├── .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插件文件夹中,但是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发布于 2014-09-22 09:56:54
所以看来问题不在于病原体,而在于Git和它没有提交我的子模块。显然,有一种使用.gitmodules文件解决这个问题的方法,但是我没有时间进一步研究它,所以我使用一些基本的Unix命令解决了这个问题:
find . -type d -name '.git' | xargs rm -rf
然后,我能够提交子模块文件夹的内容。
https://stackoverflow.com/questions/25969859
复制相似问题