mirror of
https://github.com/neovim/neovim.git
synced 2025-11-15 14:59:20 +00:00
refactor(spellfile): config() interface, docs #36481
Problem: - Exposing the raw config as table is a pattern not seen anywhere else in the Nvim codebase. - Old spellfile.vim docs still available, no new documentation Solution: - Exposing a `config()` function that both acts as "getter" and "setter" is a much more common idiom (e.g. vim.lsp, vim.diagnostic). - Add new documentation and link old docs to |spellfile.lua| instead of |spellfile.vim|.
This commit is contained in:
committed by
GitHub
parent
cf347110c1
commit
9bdb011a50
@@ -1,16 +1,12 @@
|
||||
if vim.g.loaded_spellfile_plugin ~= nil then
|
||||
return
|
||||
end
|
||||
vim.g.loaded_spellfile_plugin = true
|
||||
|
||||
--- Downloads missing .spl file.
|
||||
---
|
||||
--- @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 = '*',
|
||||
group = vim.api.nvim_create_augroup('nvim.spellfile', {}),
|
||||
desc = 'Download missing spell files when setting spelllang',
|
||||
callback = on_spellfile_missing,
|
||||
callback = function(args)
|
||||
require('nvim.spellfile').get(args.match)
|
||||
end,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user