1
0
forked from aniani/vim

runtime(netrw): Fixing powershell execution issues on Windows

closes: #16094

Signed-off-by: GuyBrush <miguel.barro@live.com>
This commit is contained in:
GuyBrush 2024-11-23 14:13:10 +01:00 committed by Christian Brabandt
parent 5e6ea92b2c
commit d7745acbd8
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -37,6 +37,7 @@
" 2024 Nov 10 by Vim Project: directory symlink not resolved in tree view (#16020) " 2024 Nov 10 by Vim Project: directory symlink not resolved in tree view (#16020)
" 2024 Nov 14 by Vim Project: small fixes to netrw#BrowseX (#16056) " 2024 Nov 14 by Vim Project: small fixes to netrw#BrowseX (#16056)
" 2024 Nov 23 by Vim Project: update decompress defaults (#16104) " 2024 Nov 23 by Vim Project: update decompress defaults (#16104)
" 2024 Nov 23 by Vim Project: fix powershell escaping issues (#16094)
" }}} " }}}
" Former Maintainer: Charles E Campbell " Former Maintainer: Charles E Campbell
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
@ -11328,9 +11329,7 @@ endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" s:NetrwExe: executes a string using "!" {{{2 " s:NetrwExe: executes a string using "!" {{{2
fun! s:NetrwExe(cmd) fun! s:NetrwExe(cmd)
" call Dfunc("s:NetrwExe(a:cmd<".a:cmd.">)") if has("win32") && exepath(&shell) !~? '\v[\/]?(cmd|pwsh|powershell)(\.exe)?$' && !g:netrw_cygwin
if has("win32")
" call Decho("using win32:",expand("<slnum>"))
let savedShell=[&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] let savedShell=[&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash]
set shell& shellcmdflag& shellxquote& shellxescape& set shell& shellcmdflag& shellxquote& shellxescape&
set shellquote& shellpipe& shellredir& shellslash& set shellquote& shellpipe& shellredir& shellslash&
@ -11340,13 +11339,11 @@ fun! s:NetrwExe(cmd)
let [&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] = savedShell let [&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] = savedShell
endtry endtry
else else
" call Decho("exe ".a:cmd,'~'.expand("<slnum>"))
exe a:cmd exe a:cmd
endif endif
if v:shell_error if v:shell_error
call netrw#ErrorMsg(s:WARNING,"shell signalled an error",106) call netrw#ErrorMsg(s:WARNING,"shell signalled an error",106)
endif endif
" call Dret("s:NetrwExe : v:shell_error=".v:shell_error)
endfun endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------