@@ -493,12 +493,18 @@ function! s:execute(dict, command, use_height, temps) abort
493
493
if has (' nvim' ) && s: is_win
494
494
let s: dict = a: dict
495
495
let s: temps = a: temps
496
+ let s: powershell = [' powershell' , ' -NoProfile' , ' -ExecutionPolicy' , ' RemoteSigned' , ' -Command' ]
496
497
let fzf = {}
497
498
function ! fzf.on_exit (job_id, exit_status, event ) dict
499
+ let temps_old = s: temps .result
500
+ let s: temps .result = tempname ()
501
+ let ps_utf8_fmt = ' Get-Content -Encoding utf8 %s | Add-Content -Encoding utf8 %s'
502
+ let ps_utf8 = printf (ps_utf8_fmt, temps_old, s: temps .result)
503
+ call system (s: powershell + [ps_utf8])
498
504
let lines = s: collect (s: temps )
499
505
call s: callback (s: dict , lines )
500
506
endfunction
501
- let cmd = [' cmd' , ' /C' , ' start' , ' /WAIT' , ' cmd ' , ' /C ' , command ]
507
+ let cmd = [' cmd' , ' /C' , ' start' , ' /WAIT' ] + s: powershell + [ command ]
502
508
call jobstart (cmd, fzf)
503
509
return []
504
510
endif
@@ -715,7 +721,7 @@ function! s:shortpath()
715
721
let short = pathshorten (fzf#fnamemodify (fzf#getcwd (), ' :~:.' ))
716
722
let slash = s: is_win ? ' \' : ' /'
717
723
let path = empty (short) ? ' ~' .slash : short . (short = ~ ' /$' ? ' ' : slash)
718
- return (s: is_win && ! has ( ' nvim ' ) ) ? escape (path , ' \' ) : path
724
+ return (s: is_win ) ? escape (path , ' \' ) : path
719
725
endfunction
720
726
721
727
function ! s: cmd (bang , ... ) abort
@@ -726,7 +732,7 @@ function! s:cmd(bang, ...) abort
726
732
if s: is_win
727
733
let opts.dir = substitute (opts.dir , ' /' , ' \\' , ' g' )
728
734
endif
729
- let dir = (s: is_win && ! has ( ' nvim ' ) ) ? escape (opts.dir , ' \' ) : opts.dir
735
+ let dir = (s: is_win ) ? escape (opts.dir , ' \' ) : opts.dir
730
736
else
731
737
let dir = s: shortpath ()
732
738
endif
0 commit comments