Background
g:previm_wsl_mode = 1 currently controls multiple WSL-specific behaviors at once.
In particular, when :PrevimOpen is executed with g:previm_open_cmd set, Previm converts the preview HTML path with wslpath -w and passes it as a Windows-style file:///C:/... URL.
This works for users who directly invoke a Windows browser executable from WSL, but it does not work well with wslview.
Problem
When using wslview, the preview HTML path should be passed as a WSL path and wslview should handle the conversion for the Windows application.
The current behavior effectively forces users to configure a Windows browser command or executable path when g:previm_wsl_mode = 1, because Previm always converts the preview path with wslpath -w.
For example, this kind of configuration is awkward or broken with wslview:
let g:previm_wsl_mode = 1
let g:previm_open_cmd = 'wslview'
Previm converts the path first, and then wslview or Windows may interpret it as an unintended path.
Proposal
Keep g:previm_wsl_mode for compatibility, but split the path format passed to g:previm_open_cmd into a separate option.
For example:
let g:previm_wsl_mode = 1
" default: 'windows'
let g:previm_wsl_open_path_format = 'windows'
Supported values:
windows: current behavior. Convert the preview HTML path with wslpath -w and pass it as a Windows file:///... URL.
wsl: pass the preview HTML path as a WSL path without converting it through wslpath -w.
Keeping the default equivalent to the current behavior preserves existing user configurations.
Example configurations
Existing usage that directly invokes a Windows browser executable:
let g:previm_wsl_mode = 1
let g:previm_open_cmd = '/mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe'
" g:previm_wsl_open_path_format defaults to 'windows'
Usage with wslview:
let g:previm_wsl_mode = 1
let g:previm_open_cmd = 'wslview'
let g:previm_wsl_open_path_format = 'wsl'
Background
g:previm_wsl_mode = 1currently controls multiple WSL-specific behaviors at once.In particular, when
:PrevimOpenis executed withg:previm_open_cmdset, Previm converts the preview HTML path withwslpath -wand passes it as a Windows-stylefile:///C:/...URL.This works for users who directly invoke a Windows browser executable from WSL, but it does not work well with
wslview.Problem
When using
wslview, the preview HTML path should be passed as a WSL path andwslviewshould handle the conversion for the Windows application.The current behavior effectively forces users to configure a Windows browser command or executable path when
g:previm_wsl_mode = 1, because Previm always converts the preview path withwslpath -w.For example, this kind of configuration is awkward or broken with
wslview:Previm converts the path first, and then
wslviewor Windows may interpret it as an unintended path.Proposal
Keep
g:previm_wsl_modefor compatibility, but split the path format passed tog:previm_open_cmdinto a separate option.For example:
Supported values:
windows: current behavior. Convert the preview HTML path withwslpath -wand pass it as a Windowsfile:///...URL.wsl: pass the preview HTML path as a WSL path without converting it throughwslpath -w.Keeping the default equivalent to the current behavior preserves existing user configurations.
Example configurations
Existing usage that directly invokes a Windows browser executable:
Usage with
wslview: