mirror of
https://github.com/junegunn/fzf.vim.git
synced 2025-12-06 12:44:24 +08:00
Fix preview support for MS Windows (WSL and Git bash) (#1215)
* Fixes #1212 * Path translation only when containing backslash. - lower letters also allowed for drive Co-authored-by: Jan Stocker <Jan.Stocker@cosmoconsult.com>
This commit is contained in:
@@ -163,6 +163,12 @@ function! fzf#vim#with_preview(...)
|
||||
endif
|
||||
if s:is_win
|
||||
let is_wsl_bash = exepath('bash') =~? 'Windows[/\\]system32[/\\]bash.exe$'
|
||||
if empty($MSWINHOME)
|
||||
let $MSWINHOME = $HOME
|
||||
endif
|
||||
if is_wsl_bash && $WSLENV !~# '[:]\?MSWINHOME\(\/[^:]*\)\?\(:\|$\)'
|
||||
let $WSLENV = 'MSWINHOME/u:'.$WSLENV
|
||||
endif
|
||||
let preview_cmd = 'bash '.(is_wsl_bash
|
||||
\ ? substitute(substitute(s:bin.preview, '^\([A-Z]\):', '/mnt/\L\1', ''), '\', '/', 'g')
|
||||
\ : escape(s:bin.preview, '\'))
|
||||
|
||||
Reference in New Issue
Block a user