Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 使用NeoBundle时,在mac和Ubuntu服务器上同步vim设置_Linux_Macos_Git_Vim - Fatal编程技术网

Linux 使用NeoBundle时,在mac和Ubuntu服务器上同步vim设置

Linux 使用NeoBundle时,在mac和Ubuntu服务器上同步vim设置,linux,macos,git,vim,Linux,Macos,Git,Vim,我想在我的Mac和远程linux Ubuntu服务器上同步vim设置。我正在使用NeoBundle进行包管理。我做了以下工作: 在Mac上,我安装了NeoBundle并在~/.vim/中创建了一个vimrc文件。参见下面的.vimrc文件 在Mac上,我使用ln-s~/.vim/vimrc~/.vimrc 我输入了.vim目录,并将其放入git存储库,将除了.netrwhist和*.swp之外的所有内容添加到存储库中 然后我将这个存储库推到了bitbucket 我登录了服务器。已删除.vim和.

我想在我的Mac和远程linux Ubuntu服务器上同步vim设置。我正在使用
NeoBundle
进行包管理。我做了以下工作:

  • 在Mac上,我安装了NeoBundle并在
    ~/.vim/
    中创建了一个vimrc文件。参见下面的.vimrc文件
  • 在Mac上,我使用
    ln-s~/.vim/vimrc~/.vimrc
  • 我输入了.vim目录,并将其放入git存储库,将除了.netrwhist和*.swp之外的所有内容添加到存储库中
  • 然后我将这个存储库推到了bitbucket
  • 我登录了服务器。已删除.vim和.vimrc。创建了一个符号链接
    ln-s~/.vim/vimrc~/.vimrc
  • 然后我在服务器上创建了.vim,并运行了推送存储库的git克隆。我在服务器上看到mac上看到的所有文件 捆绑包都在
    .vim/bundles
    中。所以它们是可用的

    Vim版本不同。这就是问题所在吗

    在Mac上,它说:

    VIM-Vi改进了7.3(2010年8月15日,2013年12月19日编译15:19:49)

    而在服务器上,它表示:

    VIM-Vi提高了7.4(2013年8月10日,2014年1月2日汇编19:39:32)

    问题:Vim在Mac上工作得很好。但是在服务器上,当我运行vim时,我得到以下错误:

    Error detected while processing /home/admin/.vimrc:
    line   16:
    E117: Unknown function: neobundle#begin
    line   20:
    E492: Not an editor command:  NeoBundleFetch 'Shougo/neobundle.vim'
    line   26:
    E117: Unknown function: neobundle#end
    line   33:
    E492: Not an editor command:  NeoBundleCheck
    line   38:
    E492: Not an editor command: NeoBundle 'scrooloose/nerdtree'
    line   39:
    E492: Not an editor command: NeoBundle 'terryma/vim-multiple-cursors'
    line   40:
    E492: Not an editor command: NeoBundle 'tomasr/molokai'
    line   41:
    E492: Not an editor command: NeoBundle '29decibel/codeschool-vim-theme'
    line   42:
    E492: Not an editor command: NeoBundle 'Lokaltog/vim-easymotion'
    line   43:
    E492: Not an editor command: NeoBundle 'jnurmine/Zenburn'
    line   64:
    E185: Cannot find color scheme 'zenburn'
    
    .vimrc包含:

    "================================================================================
    "   NeoBundle settings (copied from NeoBundle github page)
    "================================================================================
     " Note: Skip initialization for vim-tiny or vim-small.
     if !1 | finish | endif
    
     if has('vim_starting')
       set nocompatible               " Be iMproved
    
       " Required:
       set runtimepath+=~/.vim/bundle/neobundle.vim/
     endif
    
     " Required:
     call neobundle#begin(expand('~/.vim/bundle/'))
    
     " Let NeoBundle manage NeoBundle
     " Required:
     NeoBundleFetch 'Shougo/neobundle.vim'
    
     " My Bundles here:
     " Refer to |:NeoBundle-examples|.
     " Note: You don't set neobundle setting in .gvimrc!
    
     call neobundle#end()
    
     " Required:
     filetype plugin indent on
    
     " If there are uninstalled bundles found on startup,
     " this will conveniently prompt you to install them.
     NeoBundleCheck
    "================================================================================
    
    
    " Install these packages
    NeoBundle 'scrooloose/nerdtree'
    NeoBundle 'terryma/vim-multiple-cursors'
    NeoBundle 'tomasr/molokai'
    NeoBundle '29decibel/codeschool-vim-theme'
    NeoBundle 'Lokaltog/vim-easymotion'
    NeoBundle 'jnurmine/Zenburn'
    
    
    "================================================================================
    "      Editor view settings
    "================================================================================      
    syntax on
    set number 
    
    " size of a hard tabstop
    set tabstop=4
    " size of an indent
    set shiftwidth=4
    " always use spaces instead of tab characters
    set expandtab
    
    set guifont=Monaco:h16
    
    if has("gui_running")
        colorscheme codeschool
    else
        colorscheme zenburn
    endif
    
    
    "=================================================================================
    "       Other settings
    "=================================================================================
    " Use Ctrl-s to save a file in insert mode. 
    inoremap <C-s> <C-c>:w<ENTER>
    
    " make working directory same as the file being edited
    " may interfere with some plugins (see here: http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file)
    set autochdir
    
    ”================================================================================
    “NeoBundle设置(从NeoBundle github页面复制)
    "================================================================================
    “注意:跳过vim tiny或vim small的初始化。
    如果!1 |完成|结束
    如果有(“vim_启动”)
    设置“不兼容”将得到改进
    “要求:
    设置runtimepath+=~/.vim/bundle/neobundle.vim/
    恩迪夫
    “要求:
    调用neobundle#begin(展开('~/.vim/bundle/'))
    “让NeoBundle管理NeoBundle
    “要求:
    NeoBundleFetch'Shougo/neobundle.vim'
    “我的包在这里:
    “请参阅|:NeoBundle示例|。
    “注意:您没有在.gvimrc中设置neobundle设置!
    调用neobundle#end()
    “要求:
    文件类型插件缩进
    “如果在启动时发现已卸载的捆绑包,
    “这将方便地提示您安装它们。
    纽布勒切克
    "================================================================================
    “安装这些软件包
    NeoBundle'Scroloose/nerdtree'
    NeoBundle“terryma/vim多光标”
    “托马斯尔/莫洛凯”新捆绑包
    NeoBundle“29分贝/代码学校vim主题”
    NeoBundle“Lokaltog/vim测量动作”
    NeoBundle“jnurmine/Zenburn”
    "================================================================================
    “编辑器视图设置”
    "================================================================================      
    语法高亮
    设定数
    “硬挡块的大小
    设置tabstop=4
    “缩进的大小
    设置shiftwidth=4
    “始终使用空格而不是制表符
    设置扩展选项卡
    设置guifont=摩纳哥:h16
    如果有(“gui_正在运行”)
    颜色方案编码学校
    其他的
    色系zenburn
    恩迪夫
    "=================================================================================
    “其他设置
    "=================================================================================
    “使用Ctrl-s以插入模式保存文件。
    inoremap:w
    “使工作目录与正在编辑的文件相同
    “可能会干扰某些插件(请参见此处:http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file)
    设置自动硬盘驱动器
    
    尽管这篇文章已经过时,但仍然没有答案,我想我可能会对这个问题给出自己的看法。当我在OSX和Linux混合的计算机上同步配置目录时,我想如果你解决了你的问题,我会分享我的做法,以供将来参考

    首先,我将vim配置分为两个目录:

    • ~/.vim/
      ,包含配置文件和neobundle,用于在所有计算机上共享
    • ~/.local/vim
      ,其中包含捆绑包、交换文件和撤消文件
    这是第一个
    ~/.vim/
    的树:

    $HOME/.vim
     ├── README.md
     ├── neobundle.vim
     │   ├── LICENSE-MIT.txt
     │   ├── Makefile
     │   └── […] (all neobundle contents)
     └── vimrc
    
    首先,让我们在文件中设置撤消的文件:

    和交换文件:

    " swap files
    set directory=~/.local/vim/swapfiles
    
    不,你不想在计算机B上撤消计算机A,甚至最糟糕的是,你也不想让所有标准的unix
    /home/foo/*
    与非标准的
    /Users/foo/*
    混合在一起

    然后,在我的中,我以以下方式设置neobundle:

    " NeoBundle setup {{{
    filetype off
    set runtimepath+=~/.vim/neobundle.vim/
    call neobundle#begin(expand('~/.local/vim/bundle'))
    NeoBundleFetch 'Shougo/neobundle.vim'
    " }}}
    
    这就是诀窍所在:您设置运行时路径以手动添加
    neobundle.vim
    addon bundle”“转到
    ~/.vim
    中vim的运行时路径,然后告诉他在哪里查找/安装捆绑包,启动neobundle。接下来,在
    vimrc
    文件中,设置所有喜爱的捆绑包,最后以以下内容结束:

    " NeoBundle Prologue {{{
    call neobundle#end()
    filetype plugin indent on " required!
    NeoBundleCheck
    " }}}
    
    所以,现在,当我在一台新计算机上部署vim时,我要做的就是:

    git clone https://github.com/guyzmo/vimrc ~/.vimrc
    mkdir -p ~/.local/vim/bundle
    mkdir ~/.local/vim/undofiles
    mkdir ~/.local/vim/swapfiles
    vim +NeoBundleInstall +qall
    
    最后,如果这个解决方案回答了您的问题,那么您只同步必要的静态内容(什么插件和什么配置),并在本地为每台计算机生成所有动态内容。所以,您让Neobundle完成它的工作,克隆git存储库,编译和安装文件。例如,查看youcompleteme安装程序,其中定义了如何根据运行vim的主机进行安装。而且,你永远不会再有git问题了


    HTH

    服务器上的Vim版本是什么?您在
    .vimrc
    中引用的捆绑包是否在服务器上可用?这些捆绑包都在.vim/bundles中。所以它们是可用的。Vim版本不同。这就是问题所在吗?在Mac上它说:
    VIM-Vi改进了7.3(2010年8月15日,编译于2013年12月19日15:19:49)
    ,而在服务器上它说,
    VIM-Vi改进了7.4(2013年8月10日,编译于2014年1月2日19:39:32)
    @vgoff实际上,你是对的
    git clone https://github.com/guyzmo/vimrc ~/.vimrc
    mkdir -p ~/.local/vim/bundle
    mkdir ~/.local/vim/undofiles
    mkdir ~/.local/vim/swapfiles
    vim +NeoBundleInstall +qall