-1

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!

Rice
  • 3,371
  • 4
  • 19
  • 23
  • Where do you run Vim? In the Windows console or in whatever terminal emulator comes with Git bash? Can you do `:!mkdir foo` and/or `:!git status` directly in Vim? – romainl Apr 19 '16 at 18:50
  • I made some progress after updating msysGit, but now I have another problem when launching vim with the git directory successfully checked out: 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' ` – Rice Apr 21 '16 at 15:35

1 Answers1

1

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.

Anthony Geoghegan
  • 11,533
  • 5
  • 49
  • 56
  • The mkdir with an escape bang `!mkdir` actually works in Windows. The problem for me was that my environment variables were not typed correctly. – Rice Apr 21 '16 at 15:42
  • @Rice So it does. All these years, I thought `md` was the (only) Windows command to create directories. Thanks for the feedback and update. – Anthony Geoghegan Apr 21 '16 at 16:07