mirror of
https://github.com/neovim/neovim.git
synced 2026-01-06 11:27:26 +10:00
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
This commit is contained in:
committed by
Justin M. Keyes
parent
5db3544991
commit
7c5ff99e8a
15
runtime/plugin/nvim/spellfile.lua
Normal file
15
runtime/plugin/nvim/spellfile.lua
Normal file
@@ -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,
|
||||
})
|
||||
@@ -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>'))
|
||||
Reference in New Issue
Block a user