Skip to content

Tidy-ups from #44: submodule scripts, late settings, terraform-ls - #152

Merged
harleypig merged 3 commits into
masterfrom
fix/tidy-44
Nov 4, 2026
Merged

harleypig merged 3 commits into
masterfrom
fix/tidy-44

Conversation

@harleypig

@harleypig harleypig commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

The tidy-ups from #44 that were still open on master, in three commits:

  1. fix(bin)
    • set-submodule-branch: a submodule whose path is missing now makes the
      run fail. Before, it was skipped and the script still exited 0. The
      gitlink that the branch checkout moves is now committed together with
      .gitmodules, so nothing is left uncommitted.
    • mvsubmodule: the 2btested target is gone, because .vim/2btested
      no longer exists.
    • update-coc-extensions: it now adds the installed extensions to the
      .vimrc list and no longer rebuilds the list from scratch. Before, a
      machine that lacked an extension dropped it from the list for every
      machine.
  2. fix(settings)
    • coc.vim: the <Tab>/<C-Space> branches for a completion plugin
      that is not installed are removed. CheckBackspace is script-local.
      The long <CR> mapping is wrapped.
    • help.vim: the autocmds are in an augroup.
    • maps.vim: <Leader>pp is now nnoremap. In Visual mode it raised
      E481: No range allowed. Two commented-out blocks with no stated
      reason are removed.
    • xdg-settings.vim: CleanOldFiles is script-local. 'spellfile' now
      points into the spell directory this file already created. Before,
      zg wrote into the checkout's .vim.
    • ftplugins: yaml.vim adds yamllint only once. isort's poetry option
      and shfmt's options are buffer-local.
  3. fix(config)
    • languageserver.terraform no longer lists the tf filetype (TinyFugue
      in Vim; vim-polyglot gives every *.tf the terraform filetype).
    • docs/hashicorp.md says where terraform and terraform-ls actually come
      from.
    • .gitmodules now uses the same indentation on every line.
    • The fugitive-azure-devops link in docs/plugins-to-try.md points to
      its web page.

Depends on #150 for two wording changes. after/ftplugin/vim.vim now
says the early ale.vim sets g:ale_disable_lsp, and docs/json.md no
longer says the late ale.vim sets the JSONC fixer. Both statements become
true once #150 removes the .vimrc line and the late ale.vim fixer. Until
then, the vim.vim comment is still true, because the early ale.vim does
set the flag. The json.md change describes the state after #150.

Refs #44

#44 checklist

# Item Disposition
1 envsubstitute help missing closing quote Done in #121 (script removed under #45)
2 Old shell-lint: SC2319 envsubstitute, SC1091 dump-maps, shfmt in check-setup/post-clone Done earlier (#59 retired dump-maps, #121 removed envsubstitute, shfmt clean since #95). Re-checked: shfmt -d bin/ and shellcheck bin/* are clean
3 docs/proselint.md config path Done in #121
4 envsubstitute help prints a FIXME Done in #121 (script removed)
5 docs/about-docs.md line 152 over 78 columns Already fixed on master. The only long lines left are table rows, which are exempt, and markdownlint passes
6 Late coc.vim long <CR> mapping Done here
7 .vimrc line 6 long (URL) Dropped: a URL cannot be broken, so the long line is allowed
8 addsubmodule substring duplicate check Done in #122
9 update-coc-extensions malformed-JSON message Done in #141 ("Cannot parse")
10 mvsubmodule 2btested target Done here
10b mvsubmodule "and updated readme" message Done in #141
11 .gitmodules tab vs spaces Done here
12 fugitive-azure-devops .git link Done here
13 envsubstitute warn prints a literal '%s' Done in #121 (script removed)
14 envsubstitute SC2319 Done in #121 (script removed)
15 post-clone pipx substring match Done in #128
16 post-clone nvm install has no failure check Done in #141
17 post-clone "did not complete" shown in green Done in #128
18 envsubstitute unused debug() Done in #121 (script removed)
19 g:ale_disable_lsp set twice Other PR this round (#150)
20 g:ale_fixers.jsonc set twice Other PR this round (#150)
21 yaml.vim appends yamllint again each time Done here
22 Global isort_auto_poetry / shfmt_options Done here (buffer-local; ALE reads both through ale#Var)
23 docs/ansible.md / post-clone say pipx ansible brings the linters Done in #140 (#104). The page and post-clone now say it brings neither
24 vim.vim stray comment over "let b:ale_fixers Done in #139
25 ALEVirtualText* highlights Done in #143
26 .eslintrc.json Done in #143
27 Spell directory created but 'spellfile' never set Done here (made to work: 'spellfile' now points into it)
28 <leader>pp uses a recursive map in every mode Done here
29 mvsubmodule/rmsubmodule messages and unexplained commented-out lines Done in #141
30 update-coc-extensions ignores XDG_CONFIG_HOME Done in #141
31 post-clone nodejs startup file, dpkg -l Done in #141
32 update-coc-extensions.bats shfmt drift Done in #141
33 maps.vim commented-out diagnostic-navigation and terminal-launcher blocks Done here (removed. CoC diagnostics reach the quickfix list through ALE, and c[/c] and <leader>q[/q] move through it)
34 coc.vim branches for an uninstalled completion plugin Done here
35 tests/vim/oldfiles.bats name and header Other PR this round
36a help.vim autocmds outside an augroup Done here
36b after/plugin/statusline.vim autocmds Other PR this round
37a CheckBackspace, CleanOldFiles global Done here
37b CustomFoldText global Not done. tests/vim/oldfiles.bats asserts foldtext=CustomFoldText(), and another PR this round is changing that file. The fix is a one-line pair, s:CustomFoldText() in fold.vim plus that assertion, and should land after that PR
37c ToggleLineNumbers global Not done. It is in plugin/gutter.vim, which is outside this PR's files
38 coc-settings.json terraform tf filetype Done here
39 Late ale.vim Markdown TODO Other PR this round (#150)
40 mvsubmodule 2btested (repeat of 10) Done here
41 set-submodule-branch exits 0 on a missing path, leaves the gitlink uncommitted Done here
42 update-coc-extensions drops entries that are not installed Done here
43 .claude/TESTS.md does not say where helpers live Other PR this round
44 docs/hashicorp.md "via package manager" Done here

Items 37b and 37c are still open, so this PR says Refs #44, not
Closes.

Decisions

  • set-submodule-branch commits the gitlink. bin/ fixes: terraform install, submodule scripts, shared fixture, tidy-ups #141 left it for the user
    to commit. Round 2 of Small tidy-ups: envsubstitute help quote, old shell-lint warnings, proselint config path #44 asked for it to be committed. The commit names
    only .gitmodules and the submodule's path, so anything else that is
    staged stays uncommitted, as before.
  • update-coc-extensions adds and never removes. The list says what
    every machine installs, so an extension missing from one machine is not a
    reason to drop it. Removing an extension is now done by hand, and the
    usage text and docs/scripts.md say so. The list is still sorted, so on
    the current .vimrc the first run moves @yaegassy/coc-ansible to the
    top, the same as the old script did. Only lines of the form
    \ 'name', are read. A commented-out entry is not taken as an extension.
  • Spell directory: made to work, not removed. tests/vim/xdg.bats
    expects the directory, and leaving 'spellfile' empty sends zg into the
    checkout.
  • maps.vim blocks: removed, not annotated. Diagnostic navigation is
    already covered by the quickfix mappings. The terminal-launcher block
    needed an external tool, and nothing referred to it.

Testing evaluation

Run by the author, to the qa-tester's standard (no team-managed: sentinel
here).

  1. Verdict. Every behaviour change has a test. The comment and doc
    wording, the .gitmodules whitespace and the link change need none.
    The coc-settings.json filetype list has no test: the file is JSONC,
    and the suite does not test CoC configuration values (TESTS.md, grey
    area).
  2. Automatable: yes. bats: tests/shell/set-submodule-branch.bats,
    mvsubmodule.bats, update-coc-extensions.bats and the new
    tests/vim/tidy.bats.
  3. Falsifiers. Each test was seen red before its fix and green after:
    • set-submodule-branch "reports a missing submodule path, carries on,
      and fails": red while the missing path is just continued.
    • "commits the gitlink the checkout moved": red while the commit names
      only .gitmodules.
    • mvsubmodule "has no special 2btested target": red with the
      .vim/2btested branch.
    • update-coc-extensions "keeps a listed extension that is not installed
      here" and "adds the installed extensions…": red against the rebuild.
    • tidy.bats (all eight): red against master. That covers the
      uninstalled-plugin branches and the global CheckBackspace, a
      re-source that stacks the help autocmds, <Leader>pp in Visual mode,
      global CleanOldFiles, an empty 'spellfile', a duplicate yamllint,
      and the global isort/shfmt options. The backup-cleanup assertion was
      also made red on purpose by raising the age to 900 days, then
      restored.
  4. Disposition: written in this PR.
  5. Entry-point reach: the scripts were run as commands. The settings
    were exercised through Vim started on .vimrc.

Manual verification

  1. Where: a checkout of this branch, with Vim started on its .vimrc.
  2. What: open a YAML file and run :set ft=yaml, then :echo b:ale_linters, :echo &spellfile, :map <Leader>pp and :help help.
  3. Success: ['yamllint'] once. A spellfile under
    $XDG_DATA_HOME/vim/spell/en.utf-8.add. <Leader>pp listed for n
    only. Help opens in a vertical split.
  4. Failure: ['yamllint', 'yamllint'], an empty spellfile, or an
    entry for every mode.
  5. Result (run headless with a throwaway HOME and XDG directories):
    • b:ale_linters: ['yamllint'].
    • spellfile: <tmp>/d/vim/spell/en.utf-8.add.
    • :map <Leader>pp: n \pp * :set paste!<CR>.
    • :help help: two windows, help filetype.
    • bin/mvsubmodule --help and bin/set-submodule-branch --help print
      the new usage text.
    • bin/update-coc-extensions on a copy of the real .vimrc, with only
      coc-json installed: exit 0, every entry kept, and the list sorted.

Test plan

  • bash -c "trap '' PIPE; exec bats tests/shell": 100 pass.
  • bats tests/vim: 83 pass.
  • shfmt -d bin/ and shellcheck bin/*: clean.
  • markdownlint on every tracked *.md: clean.

Review

opt-out: no named review skill ran. The diff is a set of small tidy-ups,
and none of them can block or refuse work; the author's own read of the
diff stands in its place.

Points worth a second look:

  • the perl merge in update-coc-extensions;
  • the -- .gitmodules "$path" commit in set-submodule-branch;
  • the <SID> call in the <Tab> <expr> mapping, also covered by the
    existing coc.bats test that inserts a Tab at the start of a line.

Completion report

  1. Functionality works: yes. The suites and the manual run above show it.
  2. Access model: not applicable (a personal editor configuration).
  3. Permissions: not applicable.
  4. Audit logging: not applicable.
  5. Validation: not applicable. No new input is read.
  6. Errors handled: yes. set-submodule-branch now fails on a missing path,
    and update-coc-extensions keeps its existing failure messages.
  7. Testing complete: yes, see Testing evaluation.
  8. Documentation: docs/scripts.md, docs/hashicorp.md, docs/python.md,
    docs/json.md and learning.txt are updated. docs/coc-ale-setup.md
    still describes the removed <Tab>/<C-Space> branches. It belongs to
    another PR this round, so it is not edited here.
  9. AI Completion Report: this section.

Co-Authored-By: AI Agent noreply@harleypig.com

harleypig and others added 3 commits November 4, 2026 01:18
- set-submodule-branch: a missing submodule path now makes the run fail,
  and the gitlink the branch checkout moved is committed with .gitmodules.
- mvsubmodule: drop the 2btested target; .vim/2btested no longer exists.
- update-coc-extensions: add installed extensions to the .vimrc list
  instead of rebuilding it, so a machine without one no longer drops it.
- docs/scripts.md follows.

Refs #44

Co-Authored-By: AI Agent <noreply@harleypig.com>
- coc.vim: drop the <Tab>/<C-Space> branches for a completion plugin that
  is not installed, make CheckBackspace script-local, wrap the long <CR>
  mapping.
- help.vim: autocmds in an augroup, so re-sourcing does not stack them.
- maps.vim: <Leader>pp is nnoremap (in Visual mode it raised E481);
  remove the two unexplained commented-out blocks (diagnostic navigation
  and a terminal launcher).
- xdg-settings.vim: CleanOldFiles is script-local; 'spellfile' points at
  the spell directory it already creates, instead of the checkout's .vim.
- ftplugins: yaml.vim adds yamllint once; isort's poetry option and
  shfmt's options are buffer-local; vim.vim names the early ale.vim.
- docs/json.md, docs/python.md, learning.txt follow.
- tests/vim/tidy.bats covers each behaviour change.

Refs #44

Co-Authored-By: AI Agent <noreply@harleypig.com>
- coc-settings.json: terraform-ls no longer lists the tf filetype, which
  is TinyFugue in Vim; vim-polyglot gives every *.tf terraform.
- docs/hashicorp.md: terraform and terraform-ls come from HashiCorp, not
  the distribution's package manager (since #130).
- .gitmodules: the one tab-indented line uses two spaces like the rest.
- docs/plugins-to-try.md: fugitive-azure-devops links its web page.

Refs #44

Co-Authored-By: AI Agent <noreply@harleypig.com>
@harleypig
harleypig merged commit 210e463 into master Nov 4, 2026
4 checks passed
harleypig added a commit that referenced this pull request Nov 4, 2026
…er (#155)

* fix(settings): CustomFoldText is script-local (#44)

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>

* fix(settings): gutter toggles are script-local Normal-mode mappings (#44)

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>

* docs: drop the coc-ale-setup bullet on removed completion branches (#44)

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>

* test(vim): colors, ale-settings and tidy use the shared launcher (#44)

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>

---------

Co-authored-by: AI Agent <noreply@harleypig.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant