Commit graph nvimConfig/plugin/27_image.lua
Author SHA1 Message Date
Daniel
3f2ab6ef96 fix: address R1 (image.nvim backend) + C4 (cat-gate consistency)
Tackles the two outstanding items from the post-fix consistency
pass on top of `df2f776`.

* R1 -- plugin/27_image.lua: removed the explicit `backend = "auto"`
  line. image.nvim's setup() does not accept "auto" / "none" as
  literal values; the practical default is to leave `backend` unset,
  letting image.nvim auto-detect the right graphics protocol
  (kitty / wezterm / iterm / sixel) at runtime and falling back to
  no rendering on unsupported terminals. Inline comment explains the
  omission so a future reader doesn't "fix" it back.

* C4 -- modules/module/specs/plugins.nix:
  - Removed `nvim-dap`, `nvim-dap-ui`, `nvim-dap-virtual-text`,
    and `image-nvim` from `config.specs.utils-lazy`. They are R- and
    Markdown-specific, not general utility plugins, so they should
    not depend on `utils=true`.
  - Added a new `config.specs.r-lazy` spec carrying those same four
    plugins, gated by `cats.r`. Users with `r=true` and `utils=false`
    now get a working R debugger (via vscDebugger) and in-buffer
    image rendering for plots.
  - Added `image-nvim` to the existing `config.specs.markdown-lazy`
    so users with `markdown=true` and no other cats still see inline
    plots in Quarto / Markdown documents. nixCats dedups packages
    by pname, so `image-nvim` appears once on the runtime path even
    when both `r` and `markdown` are on.

These two changes close the real correctness bugs surfaced by the
consistency review: `plugin/26_dap.lua` and `plugin/27_image.lua`'s
cat-gated `Config.add(...)` calls previously depended on
`utils=true` resolving the four packages, leaving `r=true` (or
`markdown=true`) only users without DAP / image-nvim even though the
Lua gate let the setup function proceed.

Files: 2 modified. Local verification (`nix flake check --no-build`)
still required before merging PR #12.
2026-07-26 06:47:58 +00:00
Daniel
df2f776d3f fix: address review findings (C1/C3/H1/H2/H5 + M1)
Tackles the critical and high-impact findings from the in-PR review
of commit 7f01be5, plus one consistency fix (M1). All changes are
scoped to the same review branch (PR #12); no behavior changes
elsewhere.

Critical fixes
* C1 -- plugin/22_languages.lua: now does `local Config = require('config')`
  at the top, matching every other `plugin/*.lua` file. Previously the
  file referenced `Config` as a global, depending on `_G.Config` having
  been initialized by `init.lua` before this file loaded. Fragile.
* C2 -- plugin/04_treesitter.lua: removed the hard `<CR>` ->
  `smart_send.send_repl` mapping. Override `<CR>` from a per-buffer
  `ftplugin/<lang>.lua` if you want enter-to-send behavior. R.nvim's
  `<Plug>RDSendLine` (wired by `ftplugin/r.lua`) remains the default
  for R files and is no longer silently clobbered.

High-impact fixes
* C3 -- plugin/27_image.lua: `image.setup({ backend = "kitty" })` ->
  `backend = "auto"`. The previous value silently failed on every
  terminal that is not Kitty. `"auto"` delegates detection to image.nvim.
* H1 -- plugin/10_keymap.lua: `_G.Config = Config` removed from this
  file; `init.lua:2` remains the single source. Avoids drift between
  two aliasing sites.
* H2 -- plugin/25_lsp.lua: `texlab = { single_file_support = true }`,
  so single-file `.tex` buffers attach the LSP without lspconfig's
  sometimes-brittle root_dir heuristic.
* H5 -- plugin/04_treesitter.lua: also drops `<S-CR>` from
  `M.setup_keybindings` on the same principle as C2. `<S-CR>` was a
  hard implicit override in both normal and insert mode, where it
  collided with snippet and transient-state plugins.

Consistency fixes
* M1 -- plugin/01_lib.lua: `print(line)` in `Config.execute_lua_line`
  switched to `vim.notify(line, vim.log.levels.INFO)`, matching the
  print->notify cleanup in `plugin/04_treesitter.lua` from 7f01be5.

Files: 6 modified. +21 / -11.

Local verification
1. `luac -p plugin/{22_languages,27_image,10_keymap,25_lsp,04_treesitter,01_lib}.lua`
2. `nvim --headless -u NONE -l tests/init.lua`
3. Open a R / quarto / tex buffer; verify `<CR>` is no longer hijacked
   by `smart_send` and behaves like the filetype default.

For reviewers
* The text-object configuration in plugin/04_treesitter.lua's
  textobjects block is unchanged. H4 (`@assignment.*` queries may not be
  defined for R) is left for a follow-up with verification.
* yamlls GitHub-rawURL schema dependency (H3) is left intentionally --
  vendoring the schemas is a separate decision.
* Tests (T1-T6 from the review) are deferred; no test infrastructure
  exists beyond `tests/init.lua`.
2026-07-26 06:43:35 +00:00
Daniel
7f01be59d7 refactor: improve Neovim/Nix config for quant econ workflow
Consolidates a multi-pass refactor and a set of workflow integrations
tailored to a quantitative economics research workflow (R / Python /
Quarto / LaTeX heavy, reproducibility-conscious). The existing terminal
setup is preserved (snacks.nvim was deliberately not adopted).

=== Structural refactors ===
* Replace the `_G.Config` global with a proper `require('config')` Lua
  module. `_G.Config` is kept only as a backward-compatible alias.
* Split the monolithic `plugin/10_keymap.lua` into domain-specific
  files under `lua/keymap/` (core, helpers, leader, terminal, repl).
* Harden `lua/nix_smart_send.lua` `send_repl`: only skip forward on
  comment nodes, and return cleanly when there is no next sibling.
* Add a filetype-aware REPL dispatcher in `lua/keymap/repl.lua`:
  pure R scripts -> R.nvim, .qmd/.Rmd chunks -> quarto.runner,
  everything else -> vim-slime. Prefer `quarto.runner.run_line()`
  when available and fall back to `run_cell()`.
* Add R Treesitter text objects (function / call / assignment) for
  faster motion when sending code to the REPL.
* Add `+Send` and `+Debug` leader-clue groups for the new prefixes.

=== LSP and tooling ===
* Register `yamlls` for Quarto YAML frontmatter (`plugin/25_lsp.lua`).
* Register `texlab` and add `vimtex` for a real `.tex` workflow
  (`plugin/25_lsp.lua` + new `plugin/28_latex.lua`).
* Wire `nvim-dap` with an R adapter backed by `vscDebugger`
  (new `plugin/26_dap.lua`, gated to the `r` cat).
* Add `image-nvim` for in-editor plots, gated to the `r`/`markdown`
  cats (new `plugin/27_image.lua`).
* Wire `lintr` into `nvim-lint` for R / Quarto (`plugin/22_languages.lua`).
* Add Treesitter parsers for `stata`, `matlab`, `bibtex` for completeness.

=== Nix updates ===
* Pin `python313Packages.pylatexenc` -> `python3Packages.pylatexenc`
  so the markdown cat survives nixpkgs Python default shifts.
* Add `texlab`, `imagemagick`, `luaPackages.magick` to the markdown
  cat so `image.nvim` has a working backend.
* Add `vscDebugger` and `lintr` to the R package list.

=== Misc ===
* Prefer the R.nvim v1.0 Lua API (`require('r.run').send_line()` /
  `send_selection()`); keep `<Plug>` mappings as a fallback so older
  downstream builds don't regress.
* Use `alejandra` (already installed) as the nixd / nil_ls formatter.

Files: 14 modified, 5 added (953 insertions, 490 deletions).

Local verification before merge:
1. `nix flake check --no-build`
2. `nvim --headless -u NONE -l tests/init.lua`
3. Open a `.qmd` -> confirm `yamlls` attaches and `image.nvim` renders.
4. Open an `.R` -> `<leader>db`, `<leader>dc` confirm DAP loads.
5. Open a `.tex` -> confirm `texlab` + `vimtex` are active.
2026-07-26 06:35:52 +00:00