diff options
| author | Tom Ampuero <tom.ampuero.c@gmail.com> | 2025-08-08 16:31:57 +0100 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2025-10-26 00:33:41 +0200 |
| commit | 7c5ff99e8a0ef7c345596df8a0c2eec80afd16b4 (patch) | |
| tree | a10425e21679048f8c5130ba28bdd918ce1bd0c1 /runtime/plugin | |
| parent | 5db35449917de353fb8e35cbd4edca381233f381 (diff) | |
| download | rneovim-7c5ff99e8a0ef7c345596df8a0c2eec80afd16b4.tar.gz rneovim-7c5ff99e8a0ef7c345596df8a0c2eec80afd16b4.tar.bz2 rneovim-7c5ff99e8a0ef7c345596df8a0c2eec80afd16b4.zip | |
refactor(spell): migrate to Lua, drop netrw dependency
Problem:
Spell file downloads relied on Vimscript and netrw (:Nread). If netrw is
disabled, downloads fail.
Solution:
Port the logic to Lua as `nvim.spellfile` and wire it via a Lua plugin that
handles `SpellFileMissing`. Use `vim.net.request()` with a timeout for HTTP,
prompt via `vim.fn.input` and report via `vim.notify`.
Closes #7189
Diffstat (limited to 'runtime/plugin')
| -rw-r--r-- | runtime/plugin/nvim/spellfile.lua | 15 | ||||
| -rw-r--r-- | runtime/plugin/spellfile.vim | 8 |
2 files changed, 15 insertions, 8 deletions
diff --git a/runtime/plugin/nvim/spellfile.lua b/runtime/plugin/nvim/spellfile.lua new file mode 100644 index 0000000000..cafa914163 --- /dev/null +++ b/runtime/plugin/nvim/spellfile.lua @@ -0,0 +1,15 @@ +vim.g.loaded_spellfile_plugin = true + +--- Callback for SpellFileMissing: download missing .spl +--- @param args { bufnr: integer, match: string } +local function on_spellfile_missing(args) + local spellfile = require('nvim.spellfile') + spellfile.load_file(args.match) +end + +vim.api.nvim_create_autocmd('SpellFileMissing', { + group = vim.api.nvim_create_augroup('nvim_spellfile', { clear = true }), + pattern = '*', + desc = 'Download missing spell files when setting spelllang', + callback = on_spellfile_missing, +}) diff --git a/runtime/plugin/spellfile.vim b/runtime/plugin/spellfile.vim deleted file mode 100644 index e03659d6d6..0000000000 --- a/runtime/plugin/spellfile.vim +++ /dev/null @@ -1,8 +0,0 @@ -" Vim plugin for downloading spell files - -if exists("loaded_spellfile_plugin") || &cp || exists("#SpellFileMissing") - finish -endif -let loaded_spellfile_plugin = 1 - -autocmd SpellFileMissing * call spellfile#LoadFile(expand('<amatch>')) |