Vim Vundle,而不是编辑器命令

时间:2020-03-07 01:47:03

标签: windows vim cygwin vundle

我无法在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,但是随后提出的解决方案也没有起作用,我也不了解到底是怎么回事。

2 个答案:

答案 0 :(得分: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/')

答案 1 :(得分:0)

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

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