aboutsummaryrefslogtreecommitdiff
path: root/runtime/plugin/nvim/spellfile.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/plugin/nvim/spellfile.lua')
-rw-r--r--runtime/plugin/nvim/spellfile.lua15
1 files changed, 15 insertions, 0 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,
+})