fix(install): guard download_bin.vim against 'compatible' mode (dein build)
The dein/vim-plug build hook runs `vim -e -s -c "source scripts/download_bin.vim"`, which starts in 'compatible' mode. There, leading-backslash line continuations aren't recognised, so the multi-line URL string raised `E10: \ should be followed by /, ? or &`. The install actually succeeded (binary downloaded), but in silent Ex mode any emitted error makes Vim exit non-zero — so dein reported a build failure. :NuwikiInstall worked because a normal session is 'nocompatible'. Wrap the script in the standard `let s:cpo_save = &cpo | set cpo&vim` … `let &cpo = s:cpo_save` guard so line continuations parse regardless of how it's invoked. Verified the exact dein command now exits 0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,14 @@
|
||||
"
|
||||
" Invoked by Dein / vim-plug build hooks:
|
||||
" vim -e -s -c "source scripts/download_bin.vim" -c "q"
|
||||
"
|
||||
" That invocation runs in 'compatible' mode, where leading-backslash line
|
||||
" continuations aren't recognised (they'd raise E10, and any error in silent
|
||||
" Ex mode makes Vim exit non-zero — a spurious build failure). Reset
|
||||
" 'cpoptions' to the Vim default for the duration so the script parses, and
|
||||
" restore it at the end.
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:plugin_dir = fnamemodify(resolve(expand('<sfile>:p')), ':h:h')
|
||||
let s:bin_dir = s:plugin_dir . '/bin'
|
||||
@@ -89,3 +97,5 @@ else
|
||||
echohl ErrorMsg | echom 'nuwiki: install failed' | echohl None
|
||||
endif
|
||||
endif
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
|
||||
Reference in New Issue
Block a user