vimwiki icon indicating copy to clipboard operation
vimwiki copied to clipboard

Following HTML link is broken if shell is PowerShell

Open avysk opened this issue 2 years ago • 3 comments

Plug 'vimwiki/vimwiki'
let g:vimwiki_list = [
      \ {'path': '~/OneDrive/vimwiki', 'list_margin': 2},
      \ {'path': '~/vimwiki', 'list_margin': 2} ]

let g:vimwiki_ext2syntax = {}
let g:vimwiki_folding = 'syntax'

autocmd FileType vimwiki setlocal tw=80
autocmd FileType vimwiki setlocal nowrap
autocmd FileType vimwiki setlocal foldmethod=syntax
autocmd FileType vimwiki setlocal foldlevel=2

Mediawiki. I am using Windows / PowerShell (core) and my shell is set to pwsh -nop -nol. Any attempt to open HTML link ends in E371: Command not found. In autoload/vimwiki/base.vim in win32_handler it tries to call start which does not exist (it is an alias normally). Replacing start with Start-Process in line 328 fixes the problem.

Version 2023.04.04.

avysk avatar May 18 '23 08:05 avysk

Hi @avysk,

Thank you for the report and the fix. Could you please create a PR working on both PowerShell and Batch ?

tinmarino avatar Jun 14 '23 15:06 tinmarino

I'm having an issue very similar with HTML links, E371: Command not found.

For me the problem is on line: 316

Changing: execute 'silent ! start "Title" /B ' . url To: execute 'silent ! start ' . url fixes it.

This might be a vim bug because the code looks correct.

I started gvim without any vimrc using: gvim -u NONE and doing :! start "Title" /B https://www.google.com :! start "" /b https://www.google.com :! start "" https://www.google.com all give "E371: Command not found. shell returned -1" :! start https://www.google.com works.

Also no issue if i open cmd.exe and do [$ start "" /b https://www.google.com]. Weird.

FocusedWolf avatar Aug 24 '23 03:08 FocusedWolf

I'm having an issue very similar with HTML links, E371: Command not found.

For me the problem is on line: 316

Changing: execute 'silent ! start "Title" /B ' . url To: execute 'silent ! start ' . url fixes it.

The problem appears to be single quotes in the url string, which appear when shellslash is set. Vim 9 or Windows 11 appears to have changed how !start works: It no longer accepts "Title" and may issue E371: Command not found.

execute 'silent !start ' .. url works for cmd.exe.

execute 'silent ! start ' .. eval(url) works for pwsh.exe and pwoershell.exe.

jfishe avatar Mar 03 '24 00:03 jfishe