From af342b8fbdb1b26bc7ad7186fb16fc81bfb705e1 Mon Sep 17 00:00:00 2001 From: Johannes Löthberg Date: Wed, 18 Jul 2018 22:20:20 +0200 Subject: nvim: Update Plug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Johannes Löthberg --- nvim/autoload/plug.vim | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/nvim/autoload/plug.vim b/nvim/autoload/plug.vim index 143c377..52c6b2a 100644 --- a/nvim/autoload/plug.vim +++ b/nvim/autoload/plug.vim @@ -96,7 +96,7 @@ let s:plug_src = 'https://github.com/junegunn/vim-plug.git' let s:plug_tab = get(s:, 'plug_tab', -1) let s:plug_buf = get(s:, 'plug_buf', -1) let s:mac_gui = has('gui_macvim') && has('gui_running') -let s:is_win = has('win32') || has('win64') +let s:is_win = has('win32') let s:nvim = has('nvim-0.2') || (has('nvim') && exists('*jobwait') && !s:is_win) let s:vim8 = has('patch-8.0.0039') && exists('*job_start') let s:me = resolve(expand(':p')) @@ -799,7 +799,7 @@ function! s:bang(cmd, ...) let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd if s:is_win let batchfile = tempname().'.bat' - call writefile(['@echo off', cmd], batchfile) + call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = batchfile endif let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') @@ -908,7 +908,7 @@ function! s:finish(pull) call add(msgs, "Press 'R' to retry.") endif if a:pull && len(s:update.new) < len(filter(getline(5, '$'), - \ "v:val =~ '^- ' && stridx(v:val, 'Already up-to-date') < 0")) + \ "v:val =~ '^- ' && v:val !~# 'Already up.to.date'")) call add(msgs, "Press 'D' to see the updated changes.") endif echo join(msgs, ' ') @@ -1196,7 +1196,7 @@ function! s:spawn(name, cmd, opts) let s:jobs[a:name] = job let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd if !empty(job.batchfile) - call writefile(['@echo off', cmd], job.batchfile) + call writefile(["@echo off\r", cmd . "\r"], job.batchfile) let cmd = job.batchfile endif let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd) @@ -2023,7 +2023,7 @@ function! s:system(cmd, ...) let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd if s:is_win let batchfile = tempname().'.bat' - call writefile(['@echo off', cmd], batchfile) + call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = batchfile endif return system(s:is_win ? '('.cmd.')' : cmd) @@ -2357,7 +2357,7 @@ function! s:preview_commit() let cmd = 'cd '.s:shellesc(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha if s:is_win let batchfile = tempname().'.bat' - call writefile(['@echo off', cmd], batchfile) + call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = batchfile endif execute 'silent %!' cmd @@ -2426,8 +2426,13 @@ function! s:diff() \ . (cnts[1] ? printf(' %d plugin(s) have pending updates.', cnts[1]) : '')) if cnts[0] || cnts[1] - nnoremap :silent! call preview_commit() - nnoremap o :silent! call preview_commit() + nnoremap (plug-preview) :silent! call preview_commit() + if empty(maparg("\", 'n')) + nmap (plug-preview) + endif + if empty(maparg('o', 'n')) + nmap o (plug-preview) + endif endif if cnts[0] nnoremap X :call revert() -- cgit v1.2.3-54-g00ecf