Fix built-in plugin guards for old-style runtime plugins

env.vim sets g:loaded_X for twelve built-in plugins to short-circuit
them. A prior fix corrected the casing on g:loaded_logiPat, but four
of those plugins actually check the unscoped loaded_X form, not
g:loaded_X — so those four guards have been doing nothing.

Affected (all old runtime plugins predating the g:loaded_ convention):

- gzip.vim       checks `loaded_gzip`
- logiPat.vim    checks `loaded_logiPat`
- rrhelper.vim   checks `loaded_rrhelper`
- spellfile.vim  checks `loaded_spellfile_plugin`

Set both forms (g: and unscoped) for those four — belt and
suspenders. Empirically saves ~270μs at startup, mostly from gzip
which was loading its full autocmd group on every launch.

Add a regression assertion: source .vimrc, verify the four unscoped
guards exist.

Closes #81
This commit is contained in:
m1ngsama 2026-05-17 14:02:34 +08:00
parent f0c662fd5c
commit 677a4c386d
3 changed files with 16 additions and 5 deletions

View file

@ -23,6 +23,11 @@
### Fixed
- Built-in plugin guards for `gzip`, `logiPat`, `rrhelper`, and
`spellfile_plugin` are now set in both `g:`-prefixed and unscoped
forms — those four old-style runtime plugins check `loaded_X` (no
`g:`), so the previous `g:loaded_X` lines did nothing. Saves ~270μs
total at startup, mostly from gzip
- `install.sh` interactive menu and QUICKSTART now show `,ff` (current
fuzzy-find binding) instead of the stale `Ctrl+p` left over from the
native-first cleanup; `.github/demo.tape` updated to match (the

View file

@ -42,16 +42,18 @@ let g:chopsticks_markdown_conceal = get(g:, 'chopsticks_markdown_conceal',
let g:chopsticks_lsp_virtual_text = get(g:, 'chopsticks_lsp_virtual_text',
\ s:profile_full && !g:is_tty)
" Skip built-in plugins we never use
" Skip built-in plugins we never use.
" Modern plugins check g:loaded_X; older ones (gzip, logiPat, rrhelper,
" spellfile) check the unscoped loaded_X form, so we set both.
let g:loaded_2html_plugin = 1
let g:loaded_getscriptPlugin = 1
let g:loaded_gzip = 1
let g:loaded_logiPat = 1
let g:loaded_rrhelper = 1
let g:loaded_gzip = 1 | let loaded_gzip = 1
let g:loaded_logiPat = 1 | let loaded_logiPat = 1
let g:loaded_rrhelper = 1 | let loaded_rrhelper = 1
let g:loaded_tarPlugin = 1
let g:loaded_vimballPlugin = 1
let g:loaded_zipPlugin = 1
let g:loaded_tutor_mode_plugin = 1
let g:loaded_spellfile_plugin = 1
let g:loaded_spellfile_plugin = 1 | let loaded_spellfile_plugin = 1
let g:loaded_openPlugin = 1
let g:loaded_manpager_plugin = 1

View file

@ -265,6 +265,10 @@ check_vim() {
-c 'if !g:is_tty || &ttimeoutlen != 50 | cquit | endif' \
-c 'qa!' 2>&1
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
-c 'if !exists("loaded_gzip") || !exists("loaded_logiPat") || !exists("loaded_rrhelper") || !exists("loaded_spellfile_plugin") | cquit | endif' \
-c 'qa!' 2>&1
XDG_CONFIG_HOME="$EMPTY_XDG" vim -u .vimrc -i NONE -es -N \
-c 'silent! delcommand LspStatus' \
-c 'silent! delcommand LspInstallServer' \