Repository navigation
Finish #44: script-local fold and gutter functions, shared Vim launcher - #155
Merged
Merged
Conversation
The late fold.vim's fold-text function is now s:CustomFoldText(), and 'foldtext' is set with the s: form, which Vim (8.2.3908 and later) replaces with the function's <SNR> name. tests/vim/fold.bats checks for that name and that no global CustomFoldText() exists. Co-Authored-By: AI Agent <noreply@harleypig.com>
) ToggleLineNumbers and its sibling ToggleSigns in the late gutter.vim are now script-local, and <leader>ln and <leader>signs are nnoremap calls to <SID> versions. The old recursive map also defined them in Visual and Operator-pending mode, where the :call ran once per selected line. The docs name no mode for either, so they are unchanged. tests/vim/tidy.bats checks the mappings' modes, that neither function is global, and that each toggle still cycles as documented. Co-Authored-By: AI Agent <noreply@harleypig.com>
The <Tab> and <C-Space> mappings in the late coc.vim no longer check for a completion plugin that is not installed (removed in #152 - coc.vim tidy-ups), so the bullet saying they do is gone. Co-Authored-By: AI Agent <noreply@harleypig.com>
The three Vim test files added alongside #151 each carried their own copy of the headless-Vim launcher. They now load helpers/vim, set up with vim_fixture and start Vim with headless_vim, as every other file in tests/vim does. No test changes what it checks. Each file was seen to fail with one guarded behaviour broken: the Insert mode StatusLine colour (colors), g:ale_disable_lsp in the early ale.vim (ale-settings) and 'spellfile' (tidy). Co-Authored-By: AI Agent <noreply@harleypig.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The last open items from #44, in four commits:
fix(settings):CustomFoldTextis script-local. The latefold.vimdefiness:CustomFoldText()and setsfoldtext=s:CustomFoldText(). Vim replaces thes:with the function's<SNR>name when the option is set (:help fold-foldtext, patch8.2.3908), so
'foldtext'now reads<SNR>N_CustomFoldText().tests/vim/fold.batschecks for that value and that there is no globalCustomFoldText().fix(settings): the gutter toggles.ToggleLineNumbersand itssibling
ToggleSignsin the lategutter.vimare script-local.<leader>lnand<leader>signsare nownnoremapmappings that call<SID>versions. The old recursivemapalso defined both keys inVisual and Operator-pending mode, where the
:callran once for eachselected line.
docs/gutter.mdandlearning.txtname no mode foreither key, so neither changes.
docs:docs/coc-ale-setup.md. The bullet saying<Tab>and<C-Space>check for a completion plugin is removed. Tidy-ups from #44: submodule scripts, late settings, terraform-ls #152 removed thosebranches.
test(vim): the shared launcher.colors.bats,ale-settings.batsand
tidy.batsnowload helpers/vimand usevim_fixtureandheadless_vim, like every other file intests/vim. Each file kept itsown copy of the launcher before. No test changes what it checks.
Closes #44
#44 checklist
PR #152's table numbers the items. Every item it marked done is still done
on
master. The rest:g:ale_disable_lspset twiceale.vimg:ale_fixers.jsoncset twiceafter/ftplugin/json.vimtests/vim/oldfiles.batsname and headerfold.bats)after/plugin/statusline.vimautocmdsaugroup statusline)CustomFoldTextglobalToggleLineNumbersglobalToggleSignsale.vimMarkdown TODOafter/ftplugin/markdown.vim.claude/TESTS.mddoes not say where helpers livedocs/coc-ale-setup.mddescribes the removed completion branches (#152 completion report, point 8)The issue body's three items and all eight comments are covered by the
table above together with #152's.
Decisions
set foldtext=s:CustomFoldText(), notexpand('<SID>'). Thes:form is the one
:help fold-foldtextdocuments. It has been in Vim since8.2.3908, well before CI's 9.1.0016. The stored value is already the
<SNR>name, so it works in every window the option is copied to.ToggleSignsis included. Small tidy-ups: envsubstitute help quote, old shell-lint warnings, proselint config path #44 names onlyToggleLineNumbers, butToggleSignssits in the same file with the same two faults: a globalfunction and a recursive
map. Fixing one and leaving the other wouldleave the file half done.
nnoremap, notnoremap. Both toggles change window options, soVisual and Operator-pending mode have no use for them. In Visual mode the
old mapping ran the toggle once for each selected line.
tidy.bats. That file holds Small tidy-ups: envsubstitute help quote, old shell-lint warnings, proselint config path #44's smallsettings fixes. The two behaviour tests (each toggle still cycles as
documented) guard against the change breaking the keys.
Testing evaluation
Run by the author, to the qa-tester's standard (no
team-managed:sentinelhere).
wording and needs none. Commit 4 changes only test plumbing. It is
covered by its own tests still passing, and by each file going red when
one behaviour it guards is broken.
tests/vim/fold.batsandtests/vim/tidy.bats.master,which shows
foldtext=CustomFoldText()andglobal=1.master,which shows
noremap=0, a Visual mapping and both functions global.<Leader>lncycles…" and "<Leader>signshides…": redwith the
<leader>lnmapping commented out and withToggleSignssetting
signcolumn=yeswhere it should setno.StatusLine
guibgchanged to Red turned colors.bats test 1 red.g:ale_disable_lsp = 0in the earlyale.vimturned ale-settings.batstest 1 red. An empty
'spellfile'inxdg-settings.vimturnedtidy.bats test 5 red.
.vimrc. Themappings were pressed with
:normal, not just read withmaparg().Manual verification
.vimrc.:set foldtext?,:map <Leader>lnand:map <Leader>signs. Fill a buffer with three lines and run:%fold.Then press
<Leader>ln.foldtext=<SNR>N_CustomFoldText(). Each mapping is listedonce, for
nonly, with*(no remap) and a<SNR>N_call. The foldreads
alpha.... 3 lines [100.0%] +--. After<Leader>ln,nonumberand
relativenumber.foldtext=CustomFoldText(), a mapping listed withoutn,or a fold shown as Vim's default
+-- 3 lines: alpha.foldtext=<SNR>42_CustomFoldText().n \ln * :call <SNR>43_ToggleLineNumbers()<CR>.n \signs * :call <SNR>43_ToggleSigns()<CR>.alpha.............................................. 3 lines [100.0%] +--.\ln:nonumber,relativenumber.Test plan
bats tests/vim: 93 pass, with a fresh emptyTMPDIRthat is stillempty afterwards.
bash -c "trap '' PIPE; exec bats tests/shell": 100 pass, sameTMPDIRcheck.
docs/coc-ale-setup.md: clean.Review
opt-out: no named review skill ran. None of these changes can block or
refuse work, and the author read the diff in its place.
Points worth a second look:
ToggleSignsis wanted, since Small tidy-ups: envsubstitute help quote, old shell-lint warnings, proselint config path #44 names onlyToggleLineNumbers;"normal \\ln"key sequence intidy.bats. It relies on the default\leader, because nothing here setsmapleader.Completion report
docs/coc-ale-setup.mdis updated.docs/gutter.mdandlearning.txtalready describe the keys as they now behave.Co-Authored-By: AI Agent noreply@harleypig.com