Skip to content

refactor: simplify and de-duplicate the editor configuration (v0.5.0) - #6

Merged
timlinux merged 5 commits into
mainfrom
refactor/editor-cleanup
Aug 24, 2026
Merged

refactor: simplify and de-duplicate the editor configuration (v0.5.0)#6
timlinux merged 5 commits into
mainfrom
refactor/editor-cleanup

Conversation

@timlinux

Copy link
Copy Markdown
Owner

Fixes #5

Three commits: dead code and duplication, bug fixes, then the comfort
additions. Full detail in CHANGELOG.md under [0.5.0].

Removed

  • Five modules that were never imported (utility/snacks-nvim.nix,
    ui/ufo.nix, plugins/notes.nix, plugins/floaterm.nix,
    plugins/fzf.nix), the empty plugins/snacks/ and lua/ dirs, and
    plugins/filetree.nix (neo-tree, enable = false).
  • Duplicate configuration: nvim-notify was set up three times with three
    different background colours; nvim-autopairs ran alongside mini.pairs;
    python.nix redefined the whole <leader>z spell keymap set and re-armed
    the regex syntax engine per Python buffer for what treesitter's @spell
    captures already do.

Changed

  • Autosave no longer fires on TextChanged, and conform moved to
    format_after_save. Every pause after a normal-mode edit used to write the
    buffer and run a synchronous formatter on the typing path.

Fixed

  • K was mapped to an invalid Ex command, so hover errored.
  • <C-h>/<C-l> were bound twice (LSP navigation vs smart-splits).
  • <leader>cc threw: check_formatters never required conform.
  • timeoutlen was silently overridden by nvf's tm alias.
  • Telescope was set up twice, the second call resetting the declarative defaults.

Added

  • scrolloff, a reserved signcolumn, splitbelow/splitright,
    inccommand=split, confirm, tm=400.
  • ]b/[b, ]d/[d, <Esc> to clear search highlight, centred n/N,
    <leader>fr, <leader>fs, <leader>tn (inlay hints).

Verification

  • nix flake check green (11 checks, including the startup smoke test).
  • 24/24 headless assertions against the built editor: keymaps resolve, options
    applied, telescope defaults intact, autosave events correct, no duplicate
    lhs within a mode.
  • Startup: median 261 ms vs 269 ms on main (5 runs each) — within noise.

🤖 Generated with Claude Code

Tim Sutton added 5 commits August 24, 2026 17:45
Removed five modules that were never imported (utility/snacks-nvim.nix,
ui/ufo.nix, plugins/notes.nix, plugins/floaterm.nix, plugins/fzf.nix --
fzf-lua duplicated telescope), the empty plugins/snacks/ and lua/ dirs, and
plugins/filetree.nix (59 lines configuring neo-tree with enable = false;
yazi is the file manager).

Deduplicated what was configured more than once:

- nvim-notify was set up three times -- its nvf module, a duplicate
  extraPlugins copy of the same package, and again in noice.nix -- each with a
  different background colour, so whichever DAG entry ran last won. It now has
  one definition, in nvf setupOpts, with animation at 30 fps instead of 60.
- nvim-autopairs ran alongside mini.pairs, so both plugins reacted to the same
  keystroke. mini.pairs is now the only autopair provider.
- python.nix redefined the whole <leader>z spell keymap set buffer-locally,
  identically to the global one, and injected syn region/syn match rules that
  re-armed the regex syntax engine on every Python buffer to reproduce what
  treesitter's @spell captures already provide.
- treesitter.nix repeated the vim.languages.enable* flags languages.nix sets.

Autosave no longer fires on TextChanged, and conform moved from
format_on_save to format_after_save: every pause after any normal-mode edit
used to write the buffer and run a synchronous formatter straight through the
typing path. The per-write "File saved" echo is gone too -- noice was already
filtering those messages out.
- check_formatters called conform.list_formatters() without requiring conform,
  so <leader>cc threw instead of listing formatters.
- Telescope was set up twice; the second call, from luaConfigRC, re-applied
  telescope's own defaults over the declarative defaults block
  (file_ignore_patterns, the --hidden vimgrep arguments) and forced the plugin
  to initialise before nvf's setup ran. It also re-loaded three extensions nvf
  already loads. The chafa previewer's requires moved inside the function so
  the block no longer pulls telescope and plenary in at file scope.
- The <leader>tv which-key label initialised as OFF while virtual-text
  diagnostics start ON, so the first press read backwards.
- A help message pointed at <leader>ss (save session) instead of <leader>zs.
…oggle

Options: scrolloff/sidescrolloff 8, a permanently reserved signcolumn so text
no longer shifts sideways when a diagnostic or gitsign appears,
splitbelow/splitright, inccommand=split, confirm, and tm=400 for which-key
feel. tm, not timeoutlen: nvf declares the alias with a default of 500 and
emits it after the long name in the generated init.lua, so setting timeoutlen
alone was silently overwritten.

Keymaps: ]b/[b (buffers), ]d/[d (diagnostics), <Esc> to clear search
highlight, centred n/N, <leader>fr (recent files), <leader>fs (grep the word
under the cursor) and <leader>tn to toggle inlay hints, which are on by
default and get noisy in Python/TypeScript.

keymaps.nix also carries three repairs: K was mapped to
`<cmd>vim.lsp.buf.hover<CR>`, which is not a valid Ex command, so hover raised
an error; <C-h>/<C-l> were bound both as LSP jump-back/go-to-definition and as
smart-splits window navigation (window navigation keeps them, since
go-to-definition is <leader>nd/gd and jumping back is the built-in <C-o>); and
a duplicate <leader>ff plus a no-op <leader>zt are gone.

Keymap docs, keyboard diagrams and the which-key reference are regenerated
from the live config. Verified headless against the built editor: 24/24
assertions pass, and nix flake check is green.
Autosave now starts disabled and is turned on from the toggles group, where
which-key shows its ON/OFF state like the other toggles.

'autowrite' and 'autowriteall' follow the same toggle rather than staying on
behind it -- they write implicitly on buffer switches, :make and :next, which
is the same behaviour under a different name.

Verified headless against the built editor: with autosave off a dirty buffer
survives InsertLeave and BufLeave; after <leader>ta the same events write it
to disk, and toggling back restores both options.
Notifications had no policy: every message lived for 5 seconds regardless of
severity, identical messages stacked up, and the only filtering was a
vim.notify monkey-patch for direnv sitting in options.nix among the editor
options.

- Severity sets the lifetime: error 10s, warning 6s, info 2s. An error you
  cannot finish reading is worse than no error, and "Autosave enabled" does
  not deserve five seconds. An explicit timeout from the caller still wins.
- Identical messages repeated within two seconds are collapsed; language
  servers and formatters fail in bursts.
- A documented mutelist replaces the monkey-patch: direnv's per-directory
  export chatter, "No information available" from an empty hover, and the
  position_encoding deprecation warning.
- <leader>tN mutes notifications for presenting or pairing. Errors still get
  through, so a silent failure cannot hide behind it.
- <leader>Nl brings back the message that just faded, with <leader>Na (all)
  and <leader>Ne (errors only); <leader>Nd now dismisses noice's messages too.
- minimum_width 50 -> 20, so short messages get short boxes.

The decision is a pure _G.notify_policy() function with a trivial wrapper
around it, so it is directly testable: 27/27 headless assertions pass against
the built editor, covering timeouts per level, string/nil level handling,
caller overrides, each mutelist entry, dedup, and mute letting errors through.

Documented in a new handbook page, docs/user-guide/notifications.md.
@github-actions

Copy link
Copy Markdown

📄 Handbook PDF for this PR (timvim-handbook-pr-6.pdf) is ready.

Download it from the workflow artifacts (short-lived, 7 days). The site preview publishes to GitHub Pages once this merges to main.


📦 Software Bill of Materials

542 components for timvim-wrapped (runtime closure).

Licence Components
unknown 348
MIT 36
Artistic-1.0 34
Apache-2.0 19
BSD-3-Clause 12
GPL-2.0-or-later 11
GPL-3.0-or-later 10
BSD-2-Clause 9
LGPL-2.0-or-later 8
LGPL-2.1-or-later 7
HPND-sell-variant 7
MIT-open-group 5
LGPL-3.0-or-later 5
BSD-4-Clause 3
LGPL-2.1 3
… 18 more 25

Full CycloneDX + SPDX SBOMs are attached as build artefacts.

Download the full CycloneDX + SPDX SBOM (short-lived, 7 days).

@timlinux
timlinux merged commit 7f915cf into main Aug 24, 2026
6 checks passed
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.

Simplify and de-duplicate the editor configuration

1 participant