motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit 75b2a9a8daf6589f9747ff4f2d068fdea54e92ea (tree)
parent a7c54990f031ab93b556ceb25c5afb8a45c3311a
Author: Mike Williams <mrmrdubya@gmail.com>
Date:   Sat, 24 Jul 2021 12:28:07 +0100

Improve PowerShell support with recent Vim

References: https://github.com/tpope/vim-fugitive/pull/1783
Diffstat:
Mautoload/fugitive.vim | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim @@ -465,7 +465,7 @@ function! s:BuildEnvPrefix(env) abort let env = items(a:env) if empty(env) return '' - elseif &shellcmdflag =~# '-Command' + elseif &shell =~? '\%(powershell\|pwsh\)\%(\.exe\)\=$' return join(map(env, '"$Env:" . v:val[0] . " = ''" . substitute(v:val[1], "''", "''''", "g") . "''; "'), '') elseif s:winshell() return join(map(env, '"set " . substitute(join(v:val, "="), "[&|<>^]", "^^^&", "g") . "& "'), '') @@ -1607,9 +1607,11 @@ function! s:TempCmd(out, cmd) abort try let cmd = (type(a:cmd) == type([]) ? fugitive#Prepare(a:cmd) : a:cmd) let redir = ' > ' . a:out - if (s:winshell() || &shellcmdflag ==# '-Command') && !has('nvim') + if s:winshell() && !has('nvim') let cmd_escape_char = &shellxquote == '(' ? '^' : '^^^' return s:SystemError('cmd /c "' . s:gsub(cmd, '[<>%]', cmd_escape_char . '&') . redir . '"') + elseif &shell =~? '\%(powershell\|pwsh\)\%(\.exe\)\=$' + return s:SystemError(&shell . ' ' . &shellcmdflag . ' ' . s:shellesc(cmd . redir)) elseif &shell =~# 'fish' return s:SystemError(' begin;' . cmd . redir . ';end ') else