Repository navigation
Finish OLD_FILES, save undo, XDG_DOTVIM fallback, :help mappings reference (#4, #129, #137, #103) - #142
Merged
Conversation
The mappings left in OLD_FILES/misc.vim move to the late maps.vim, and diffopt+=algorithm:patience to set.vim, each with a test in tests/vim/ seen red before the move and green after. Each was checked against the mappings and plugins already loaded: * <Leader>O, <Leader>o, <Leader>y, <Leader>b, <Leader>ml and Y were unmapped, and no existing mapping starts with them. * S is Normal-mode only; vim-surround's S is Visual mode, and its Normal-mode keys (ys, yS, cs, ds) are untouched. Built-in S is cc. * . clashed with vim-repeat: the first time vim-surround calls repeat#set, vim-repeat's autoload file maps . to <Plug>(RepeatDot), replacing ours without a word. maps.vim now loads that autoload file itself and maps . through <Plug>(RepeatDot), so surround changes still repeat and the cursor still returns to where the change started. Without vim-repeat, . uses the built-in repeat. * AppendModeline becomes script-local. OLD_FILES/ is deleted, and its mention in .claude/WORKFLOW.md. Closes #4 Co-Authored-By: AI Agent <noreply@harleypig.com>
xdg-settings.vim set undodir under the XDG state directory, but nothing set undofile, so Vim never wrote an undo file there and undo history was lost when a buffer was unloaded. undofile is now set beside undodir; the existing 90-day clean-up of that directory applies to the undo files. tests/vim/xdg.bats checks undofile is on in each of its XDG cases, alongside the undodir it already checked. Closes #129 Co-Authored-By: AI Agent <noreply@harleypig.com>
.vimrc put $XDG_DOTVIM/.vim at the front of runtimepath and packpath. Unset, that is /.vim, and Vim started on its own defaults with none of the settings and no error. Unset or empty, XDG_DOTVIM now takes the directory .vimrc is in, resolving a ~/.vimrc symlink to the checkout it points into. A set XDG_DOTVIM is used as before. Falling back was chosen over failing with a message: .vimrc always sits at the top of the checkout it configures, so the right directory is known and an error would only ask the user to type it. The variable itself is set rather than a script-local, so the two set lines are unchanged and anything Vim starts sees the same value. tests/vim/vimrc.bats covers XDG_DOTVIM set, unset, empty, and a ~/.vimrc symlink; the symlink case goes red without resolve(). Closes #137 Co-Authored-By: AI Agent <noreply@harleypig.com>
The hand-written languageserver.html block in coc-settings.json never starts: it names vscode-html-languageservice, a library with no command, and lists the mustache filetype where vim-polyglot sets html.mustache. coc-html (npm, 1.9.2, neoclide/coc-html) bundles the same HTML language service, so it goes in g:coc_global_extensions, in name order after coc-git. Removing the block from coc-settings.json lands separately. Refs #21 Refs #133 Co-Authored-By: AI Agent <noreply@harleypig.com>
learning.txt listed keys that are not mapped and missed ones that are. * Removed: [g / ]g and <Leader>adr, whose mappings are commented out in maps.vim, and the <Tab> and <C-Space> branches for a completion plugin that is not installed. * Added: the editing mappings moved in from OLD_FILES (#4) - <Leader>O, <Leader>o, S, Y, ., <Leader>ml - with <Leader>y and <Leader>b; the quickfix list's :QuickfixToggle, <Leader>qf, <Leader>q] and <Leader>q[; and the right-hand help split capped at 80 columns. * Refiled: w!! from "Git Integration" to its own "Writing as Root" section, now saying what it expands to (:SudoWrite with vim-eunuch, :w !sudo tee > /dev/null % without); c[ / c] to the quickfix section, marked CoC-only; the help-buffer <Return> and <C-[> mappings from the built-ins to "Help Windows", since this configuration defines them. * <Leader>pp says it has no Insert-mode counterpart, and the CoC section says its mappings exist only with Node.js. The gutter tag that docs/gutter.md links to is kept. Closes #103 Co-Authored-By: AI Agent <noreply@harleypig.com>
The area:filetypes entry still named checkfiletype.vim and the Perl linter helpers in tools/, both removed in #124. The area:editor entry named "diff", which meant after/diff.vim, also removed there; it now says "diff options", for the diffopt setting set.vim holds since #4. Refs #124 Co-Authored-By: AI Agent <noreply@harleypig.com>
Each was checked in Vim 9.1 with this configuration loaded:
* terse only adds the s flag to shortmess, and shortmess=a further down
replaces the whole value, so the flag never survived.
* scroll=11 is reset to half the window height as soon as Vim learns the
terminal size (":verbose set scroll?" reads "Last set from changed
window size"; 19 in a 40-row terminal). In an 8-row terminal it
raised "E49: Invalid scroll size" at startup first.
* wrapmargin=2 is not used while textwidth is non-zero, and set.vim
sets textwidth=78.
Removed rather than made to work: making them take effect would change
behaviour nobody has seen from this configuration (search-wrap messages
gone, a fixed CTRL-D step). After the removal an 8-row terminal starts
without E49, and the Vim suite passes.
Refs #109
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.
Finishes the editor work left after #127 and #123: the last settings in
OLD_FILES/move in, undo history is saved,.vimrcworks withXDG_DOTVIMunset, and the:helpmappings reference matches themappings. One commit per item.
Closes #4
Closes #129
Closes #137
Closes #103
Refs #124
Refs #21
Refs #133
Refs #109
What changed, and why
#4: the rest of
OLD_FILES/moves in, and the directory goesThe mappings move to the late
maps.vimanddiffopt+=algorithm:patiencemoves to
set.vim. Each one was checked against what is already mappedand loaded:
<Leader>O,<Leader>o,<Leader>y,<Leader>b,<Leader>mlandYwere unmapped, and no existing mapping starts with any of them.
Sis Normal mode only. vim-surround'sSis a Visual-mode mapping, andits Normal-mode keys (
ys,yS,cs,ds) are untouched. The built-inSdoes the same ascc, which still works..clashed with vim-repeat. The first time vim-surround callsrepeat#set, vim-repeat's autoload file maps.to<Plug>(RepeatDot),and that silently replaced our mapping.
maps.vimnow loads thatautoload file itself and maps
.through<Plug>(RepeatDot). Surroundchanges still repeat, and the cursor still goes back to where the change
started. Without vim-repeat,
.falls back to Vim's own repeat. Composingthe two was chosen over dropping the mapping because it keeps both
behaviours.
AppendModelinebecomes script-local (s:), since only its mappingcalls it.
OLD_FILES/is deleted, along with its mention in.claude/WORKFLOW.md.#129:
undofileset undofilenow sits besideundodirinxdg-settings.vim, so theexisting 90-day clean-up of that directory covers the undo files.
#137:
XDG_DOTVIMunset or emptyDecision: fall back, rather than fail loudly. When
XDG_DOTVIMisunset or empty, it now takes the directory
.vimrcis in, and a~/.vimrcsymlink is followed to the checkout it points into..vimrcalways sits at the top of the checkout it configures, so the right
directory is already known, and an error message would only ask the user
to type it in. The variable itself is set, rather than a script-local
copy, so the two
setlines stay as they were and anything Vim startssees the same value.
#103: the
:helpmappings reference[g/]gand<Leader>adr, whose mappings are commentedout, and the
<Tab>/<C-Space>notes for a completion plugin that isnot installed.
<Leader>y,<Leader>b, thequickfix list (
:QuickfixToggle,<Leader>qf,<Leader>q],<Leader>q[), and the help window, which opens on the right at no morethan 80 columns.
w!!now has its own "Writing as Root" section saying what itexpands to.
c[/c]are in the quickfix section, marked as needingCoC. The help-buffer
<Return>/<C-[>mappings are now listed as thisconfig's, not as built-ins. The CoC section now says it needs Node.js.
learning-guttertag, whichdocs/gutter.mdlinks to, is kept.Area register (
.claude/WORKFLOW.md, Refs #124)area:filetypesno longer namescheckfiletype.vimor the Perl helpers intools/, both removed in #124. Inarea:editor, "diff" (which meant theremoved
after/diff.vim) becomes "diff options", meaning thediffoptthis PR adds to
set.vim.coc-html(Refs #21, #133)coc-htmlis added tog:coc_global_extensionsaftercoc-git. On thenpm registry it is version 1.9.2, from neoclide/coc-html. It bundles the
HTML language service that the hand-written
languageserver.htmlblock incoc-settings.jsontries to provide. That block never starts: it names alibrary with no command, and it lists the
mustachefiletype wherevim-polyglot sets
html.mustache. Removing the block fromcoc-settings.jsonlands in the separate intellisense PR, not here.Three
set.vimoptions that never took effect (Refs #109)Each was checked with this configuration loaded:
terseonly adds thesflag toshortmess, and the latershortmess=areplaces it.scroll=11is reset to half the window height at startup ("Last setfrom changed window size"). In an 8-row terminal it raised
E49: Invalid scroll sizefirst.wrapmargin=2is ignored whiletextwidth=78is set.Decision: remove them rather than make them work. Making them work
would bring in behaviour this configuration has never actually had. After
the removal, an 8-row terminal (a real pty, via
script) starts withoutE49. No automated test was added: theE49case needs a realshort terminal, and headless
vim -esalways reports 24 lines.Testing evaluation
Run to the qa-tester's standard by the PR author; the team-managed
delegation norm does not apply in this repository.
tests/vim/maps.bats, 9 new tests driven through:normal.withnnoremapagain (the vim-surround test goes red); dropping the fallback branch without vim-repeatdiffopttests/vim/set.batsdiffoptlineundofiletests/vim/xdg.bats, which now checksundofile=1in all 3 XDG casesset undofileXDG_DOTVIMfallbacktests/vim/vimrc.bats: set, unset, empty, and a~/.vimrcsymlinkresolve()(the symlink test goes red, checked by doing it)learning.txtcoc-htmlEvery new test was run red against the code before the change, then green
after it.
bats tests/vim: 61 ok.bats tests/shell: passes. markdownlint(CI image): clean.
Entry-point reach: the
.vimrcfallback was exercised through the realentry point (
vim -u <path>) in all four states, including a symlinked~/.vimrc.Manual verification
XDG_DOTVIMunset, in any directory.Do:
vim -N -u /path/to/dotvim/.vimrc, then:echo &rtp.Success: the first entry is
/path/to/dotvim/.vim, and:help learningopens on the right.Failure: the first entry is
/.vim, orE149forlearning.:help learning-editing.Success: "3. Editing" lists
<Leader>O,<Leader>o,S,Y,.and
<Leader>ml.foo bar, then0ysiw",Wand..Success: the line reads
"foo" "bar".:w, quit, reopen it, and pressu.Success: the edit is undone. The undo file is under
$XDG_STATE_HOME/vim/undo(or~/.local/state/vim/undo).What happened: each step was run headless (
vim -es, no terminal), onthis branch:
vimrc.bats;rtp0andpackpathstart at thecheckout's
.vim, and:QuickfixToggleexists.:helpjumped tolearning-editing,learning-quickfix,learning-sudo,learning-helpandlearning-gutter, each landing onits section heading, with no error.
maps.bats; the line reads"aa" "bb", and.isstill
<Plug>(RepeatDot)followed by`[.:write,filereadable(undofile(...))was 1, and thefile was in
state/vim/undo.The interactive Insert-mode and terminal steps were not run in a real
terminal.
Completion report
XDG_DOTVIM; unset and emptyare handled, and a set value is used as given, as before.
repeat, and the test suite checks for no errors at startup.
:helpreference is updated. Notcomplete:
README.mdstill saysXDG_DOTVIMmust be set, and thatstartup fails without
XDG_STATE_HOME/XDG_DATA_HOME, which has beenfalse since fix: XDG fallbacks, w!!, paste toggle and ALE linter names (#85, #101, #25, #100) #123. That file is outside this PR. Risk: a reader sets
variables that are no longer needed; nothing breaks. Next: a README
pass.
Review
opt-out: no review skill ran. The change refuses no work: it adds no hook,
guard or gate. The judgement calls a reviewer should check are the
composed
.mapping, which loads vim-repeat's autoload file at startupand so also maps
u,Uand<C-R>from the start rather than on firstuse, and the #137 fallback, which sets
$XDG_DOTVIMin Vim's environment.Co-Authored-By: AI Agent noreply@harleypig.com