【问题标题】:Vim Vundle, not an editor commandVim Vundle,不是编辑器命令
【发布时间】:2020-03-07 01:47:03
【问题描述】:

我在 Vim (Windows 10) 上安装 vundle 时遇到问题。按照此处https://github.com/VundleVim/Vundle.vim 的说明,我基本上可以修改我的vimrc。当我尝试运行:PluginInstall 时,我得到的输出是没有这样的命令。这是我的 vimrc,已修改:

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
call vundle#end()            " required
filetype plugin indent on    " required

" Vim with all enhancements
source $VIMRUNTIME/vimrc_example.vim

" Use the internal diff if available.
" Otherwise use the special 'diffexpr' for Windows.
if &diffopt !~# 'internal'
  set diffexpr=MyDiff()
endif
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg1 = substitute(arg1, '!', '\!', 'g')
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg2 = substitute(arg2, '!', '\!', 'g')
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let arg3 = substitute(arg3, '!', '\!', 'g')
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
      if empty(&shellxquote)
        let l:shxq_sav = ''
        set shellxquote&
      endif
      let cmd = '"' . $VIMRUNTIME . '\diff"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  let cmd = substitute(cmd, '!', '\!', 'g')
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
  if exists('l:shxq_sav')
    let &shellxquote=l:shxq_sav
  endif
endfunction
set number
set encoding=utf-8

正在寻找解决方案我在这里突然遇到Vundle - E492: Not an editor command: PluginInstall这个评论:

这发生在我的工作机器 (Windows) 上,因为我使用的是 Cygwin VIM。问题是,当我克隆 Vundle.vim 时,它使用了 Windows 样式的行尾,并且 Vundle 插件没有加载。我必须运行 find ~/.vim -type f -iname '*.vim' -exec dos2unix {} \+ 才能将我的文件转换为 unix 行尾,然后才能正常工作。

这假设您已安装 dos2unix

我确实已经安装了 Cygwin 并运行了 windows,但是所提出的解决方案也没有奏效,我也真的不明白可能是什么问题。

【问题讨论】:

    标签: windows vim cygwin vundle


    【解决方案1】:

    问题与 cygwin 有关,因为 git 和 cygwin 会以不同的方式解释路径,我这样做了:

    $ git clone https://github.com/VundleVim/Vundle.vim.git /cygwin64/home/USERNAME/.vim/bundle/Vundle.vim 
    

    然后在 vimrc 中而不是

     set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() 
    

    我把这个

    set rtp+=c:/cygwin64/home/USERNAME/.vim/bundle/Vundle.vim/ call vundle#begin('c:/cygwin64/home/USERNAME/.vim/bundle/')
    

    【讨论】:

      【解决方案2】:

      您的 Windows 机器和路径上(不是在 cygwin 中)是否安装了 curlgit?您应该能够在命令提示符下同时键入两者并查看一些输出。

      The wiki 指定 git 和 curl 作为 Windows 上 Vundle 的要求。

      【讨论】:

      猜你喜欢
      • 2014-08-02
      • 1970-01-01
      • 1970-01-01
      • 2015-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-20
      • 1970-01-01
      相关资源
      最近更新 更多