# HG changeset patch # User Meredith Howard # Date 1495423699 14400 # Node ID 3874b97048b0f14b9a20a2ebe972f0a448776e1a # Parent f7755d123d0476e6416f6e2624d544fc077de1b2 Move vundle install to func, switch to begin/end vundle interface diff --git a/.vim/autoload/vimrc.vim b/.vim/autoload/vimrc.vim --- a/.vim/autoload/vimrc.vim +++ b/.vim/autoload/vimrc.vim @@ -19,3 +19,29 @@ function! vimrc#MkNonExDir(file, buf) ab endif endfunction +function! vimrc#VundleInstall() abort + " on windows and not cygwin + let l:on_windows = (has('win32') || has('win64')) + + let l:vundle_readme = expand(l:on_windows + \ ? '~/vimfiles/bundle/vundle/README.md' + \ : '~/.vim/bundle/vundle/README.md') + + if !filereadable(l:vundle_readme) + if !executable('git') + echo "Can't autoinstall Vundle without git" + return + endif + + if l:on_windows == 0 + silent !mkdir -p ~/.vim/bundle + silent !git clone --depth 1 https://github.com/gmarik/vundle ~/.vim/bundle/vundle + else + silent execute '!mkdir "'. $HOME .'\vimfiles\bundle"' + silent execute '!git clone --depth 1 https://github.com/gmarik/vundle "'. $HOME .'\vimfiles\bundle\vundle"' + endif + + echo "Installed Vundle, run :PluginInstall if desired" + endif + +endfunction diff --git a/.vimrc b/.vimrc --- a/.vimrc +++ b/.vimrc @@ -8,35 +8,14 @@ let s:on_windows=(has('win32') || has('w let s:filename=expand('') " Set up Vundle and plugins {{{ - let s:installed_vundle=0 - - let s:vundle_readme=expand(s:on_windows - \ ? '~/vimfiles/bundle/vundle/README.md' - \ : '~/.vim/bundle/vundle/README.md') - - if !filereadable(s:vundle_readme) - if !executable('git') - echo "You probably want git installed and in PATH." - quit - endif - - echo "Installing Vundle and Plugins...\n" - if s:on_windows == 0 - silent !mkdir -p ~/.vim/bundle - silent !git clone --depth 1 https://github.com/gmarik/vundle ~/.vim/bundle/vundle - else - silent execute '!mkdir "'. $HOME .'\vimfiles\bundle"' - silent execute '!git clone --depth 1 https://github.com/gmarik/vundle "'. $HOME .'\vimfiles\bundle\vundle"' - endif - let s:installed_vundle=1 - endif + call vimrc#VundleInstall() if s:on_windows == 0 set rtp+=~/.vim/bundle/vundle/ - call vundle#rc() + call vundle#begin() else set rtp+=~/vimfiles/bundle/vundle/ - call vundle#rc('~/vimfiles/bundle') + call vundle#begin('~/vimfiles/bundle') endif Plugin 'gmarik/vundle' @@ -84,15 +63,11 @@ let s:filename=expand('') catch endtry - if s:installed_vundle == 1 - echo "Installing Plugins, please ignore key map error messages\n" - :PluginInstall - endif + call vundle#end() " }}} " Key maps {{{ - nmap :Unite buffer nmap :Unite -quick-match -short-source-names window tab:no-current nmap :Unite session