aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/nvim/spellfile.lua
diff options
context:
space:
mode:
authorOlivia Kinnear <git@superatomic.dev>2025-12-06 16:20:02 -0600
committerGitHub <noreply@github.com>2025-12-06 17:20:02 -0500
commit4e1644d4d3cb6b2ae7bd7110add8424e5217882b (patch)
tree909da6f52487ff6b74a597da996fe077a14fb57f /runtime/lua/nvim/spellfile.lua
parent5370b7a2e0a0484c9005cb5a727dffa5ef13b1ed (diff)
downloadrneovim-4e1644d4d3cb6b2ae7bd7110add8424e5217882b.tar.gz
rneovim-4e1644d4d3cb6b2ae7bd7110add8424e5217882b.tar.bz2
rneovim-4e1644d4d3cb6b2ae7bd7110add8424e5217882b.zip
feat(spell): opt-out of confirm when downloading spellfiles #36836
Diffstat (limited to 'runtime/lua/nvim/spellfile.lua')
-rw-r--r--runtime/lua/nvim/spellfile.lua31
1 files changed, 20 insertions, 11 deletions
diff --git a/runtime/lua/nvim/spellfile.lua b/runtime/lua/nvim/spellfile.lua
index 63882c37a3..45bfd5b872 100644
--- a/runtime/lua/nvim/spellfile.lua
+++ b/runtime/lua/nvim/spellfile.lua
@@ -25,11 +25,16 @@ local M = {}
--- Number of milliseconds after which the [vim.net.request()] times out.
--- (default: 15000)
--- @field timeout_ms integer
+---
+--- Whether to ask user to confirm download.
+--- (default: `true`)
+--- @field confirm boolean
--- @type nvim.spellfile.Opts
local config = {
url = vim.g.spellfile_URL or 'https://ftp.nluug.nl/pub/vim/runtime/spell',
timeout_ms = 15000,
+ confirm = true,
}
--- Configure spellfile download options. For example:
@@ -270,18 +275,22 @@ function M.get(lang)
return
end
- local prompt = ('No spell file found for %s (%s). Download? [y/N] '):format(
- info.lang,
- info.encoding
- )
- vim.ui.input({ prompt = prompt }, function(input)
- -- properly clear the message window
- vim.api.nvim_echo({ { ' ' } }, false, { kind = 'empty' })
- if not input or input:lower() ~= 'y' then
- return
- end
+ if config.confirm then
+ local prompt = ('No spell file found for %s (%s). Download? [y/N] '):format(
+ info.lang,
+ info.encoding
+ )
+ vim.ui.input({ prompt = prompt }, function(input)
+ -- properly clear the message window
+ vim.api.nvim_echo({ { ' ' } }, false, { kind = 'empty' })
+ if not input or input:lower() ~= 'y' then
+ return
+ end
+ download(info)
+ end)
+ else
download(info)
- end)
+ end
return info
end