changeset 237:6f3eb83613bf

Update vimplug
author zegervdv <zegervdv@me.com>
date Mon, 09 Feb 2015 20:25:36 +0100
parents 639222e1ab7b
children b3bf31ff1c1c
files .gitignore vim/autoload/plug.vim
diffstat 2 files changed, 23 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/.gitignore	Sat Feb 07 22:12:55 2015 +0100
+++ b/.gitignore	Mon Feb 09 20:25:36 2015 +0100
@@ -1,3 +1,4 @@
 vimwiki_html
 *.vim.lock
 vim/thesaurus/
+*.vim.old
--- a/vim/autoload/plug.vim	Sat Feb 07 22:12:55 2015 +0100
+++ b/vim/autoload/plug.vim	Mon Feb 09 20:25:36 2015 +0100
@@ -736,7 +736,7 @@
     catch
       let lines = getline(4, '$')
       let printed = {}
-      silent 4,$d _
+      silent! 4,$d _
       for line in lines
         let name = s:extract_name(line, '.', '')
         if empty(name) || !has_key(printed, name)
@@ -777,7 +777,7 @@
   for [name, j] in items(s:jobs)
     silent! call jobstop(j.jobid)
     if j.new
-      call system('rm -rf ' . s:shellesc(g:plugs[name].dir))
+      call s:system('rm -rf ' . s:shellesc(g:plugs[name].dir))
     endif
   endfor
   let s:jobs = {}
@@ -914,6 +914,7 @@
   let spec = remove(s:update.todo, name)
   let pull = s:update.pull
   let new  = !isdirectory(spec.dir)
+  let prog = s:nvim ? '--progress' : ''
 
   call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
   redraw
@@ -923,8 +924,8 @@
     if valid
       if pull
         call s:spawn(name,
-          \ printf('(git fetch --progress 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only origin/%s 2>&1 && git submodule update --init --recursive 2>&1)',
-          \ s:shellesc(spec.branch), s:shellesc(spec.branch)), { 'dir': spec.dir })
+          \ printf('(git fetch %s 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only origin/%s 2>&1 && git submodule update --init --recursive 2>&1)',
+          \ prog, s:shellesc(spec.branch), s:shellesc(spec.branch)), { 'dir': spec.dir })
       else
         let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 }
       endif
@@ -933,7 +934,8 @@
     endif
   else
     call s:spawn(name,
-          \ printf('git clone --progress --recursive %s -b %s %s 2>&1',
+          \ printf('git clone %s --recursive %s -b %s %s 2>&1',
+          \ prog,
           \ s:shellesc(spec.uri),
           \ s:shellesc(spec.branch),
           \ s:shellesc(s:trim(spec.dir))), { 'new': 1 })
@@ -1191,8 +1193,16 @@
 endfunction
 
 function! s:system(cmd, ...)
-  let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
-  return system(s:is_win ? '('.cmd.')' : cmd)
+  try
+    let sh = &shell
+    if !s:is_win
+      set shell=sh
+    endif
+    let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
+    return system(s:is_win ? '('.cmd.')' : cmd)
+  finally
+    let &shell = sh
+  endtry
 endfunction
 
 function! s:system_chomp(...)
@@ -1252,6 +1262,7 @@
 
   let allowed = {}
   for dir in dirs
+    let allowed[s:dirpath(fnamemodify(dir, ':h:h'))] = 1
     let allowed[dir] = 1
     for child in s:glob_dir(dir)
       let allowed[child] = 1
@@ -1280,7 +1291,7 @@
     if yes
       for dir in todo
         if isdirectory(dir)
-          call system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(dir))
+          call s:system((s:is_win ? 'rmdir /S /Q ' : 'rm -rf ') . s:shellesc(dir))
         endif
       endfor
       call append(line('$'), 'Removed.')
@@ -1297,7 +1308,7 @@
   redraw
   try
     if executable('curl')
-      let output = system(printf('curl -fLo %s %s', s:shellesc(new), s:plug_src))
+      let output = s:system(printf('curl -fLo %s %s', s:shellesc(new), s:plug_src))
       if v:shell_error
         throw get(s:lines(output), -1, v:shell_error)
       endif
@@ -1510,7 +1521,7 @@
     \   ['@echo off', ':: Generated by vim-plug', ':: '.strftime("%c"), '',
     \    ':: Make sure to PlugUpdate first', '', 'set PLUG_HOME='.s:esc(home)]] :
     \ ['sh', '$PLUG_HOME',
-    \   ['#!/bin/bash',  '# Generated by vim-plug', '# '.strftime("%c"), '',
+    \   ['#!/bin/sh',  '# Generated by vim-plug', '# '.strftime("%c"), '',
     \    'vim +PlugUpdate +qa', '', 'PLUG_HOME='.s:esc(home)]]
 
   call s:prepare()
@@ -1535,7 +1546,7 @@
   if a:0 > 0
     let fn = s:esc(expand(a:1))
     call writefile(getline(1, '$'), fn)
-    if !s:is_win | call system('chmod +x ' . fn) | endif
+    if !s:is_win | call s:system('chmod +x ' . fn) | endif
     echo 'Saved to '.a:1
     silent execute 'e' fn
   endif