I recently installed Vim for Windows, and I am trying to port my vimrc from Linux.
The bash script in the vimrc I need to make work is as follows :
set nocompatible
source $VIM
behave mswin
let iCanHazVundle=1
let vundle_readme=expand('$VIM/bundle/vundle/README.md')
if !filereadable(vundle_readme)
echo "Installing Vundle..."
echo ""
silent !mkdir $VIM/bundle
silent !git clone https://github.com/gmarik/vundle $VIM/bundle/vundle
let iCanHazVundle=0
endif
" required for vundle
filetype off
set rtp+=$VIM/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'Rip-Rip/clang_complete
Notice that this basically just checks to see if my Vundle packages have been installed or not(based on the existence of a readme), and installs them if not. I included the first Bundle
call to give you an idea of how it executes. The only difference in the code below and my original Linux Script is that I replaced all entries to the Linux file system: ~/.vim
with $VIM
. When I run :echo $VIM in the Windows Vim terminal it gives me the proper path. The script runs, however it always fails to call vundle#rc() and subsequently fails outright for all the Bundle
calls. Note that I do have the msysGit installed.
EDIT The mkdir function was actually working and my environment variable was typed wrong into the console. Also, msysGit needed to be upgraded (failing for unknown reasons. Now I am faced with the problem :
Error detected while processing C:\Program Files (x86)\Vim\_vimrc:
line 58:
E117: Unknown function: vundle#rc
line 62:
E492: Not an editor command: Bundle 'Rip-Rip/clang_complete'
Any suggestions are greatly appreciated!
It seems that the main problem you have is with the line,
silent !mkdir $VIM/bundle
Using the !
shell escape, this tires to call the external command mkdir
. However, this command doesn't exist on Windows (unless you've installed Cygwin or similar and the GNU tools are in your path) and the use of silent
means the error message is not printed so screen.
To create the directory in any operating system, you can use Vim's own built-in mkdir()
function. The following command using string concatenation (using the .
operator) to build the directory path should work:
call mkdir($VIM . "/bundle")
If the directory is created correctly, the following external git
command should work as long as you have git
installed and available in your Windows PATH
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.