Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Can't setup different spell language other than english #677

Closed
3 tasks done
SGman98 opened this issue Mar 19, 2023 · 4 comments
Closed
3 tasks done

bug: Can't setup different spell language other than english #677

SGman98 opened this issue Mar 19, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@SGman98
Copy link

SGman98 commented Mar 19, 2023

Did you check docs and existing issues?

  • I have read all the lazy.nvim docs
  • I have searched the existing issues of lazy.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.8.3

Operating system/version

Windows version: 10.0.22621.1413 - WSL version: 1.1.3.0

Describe the bug

When trying to use spelllang set to a different language other than english I get the following error

spellfile#LoadFile(): No (writable) spell directory found.
Warning: Cannot find word list "es.utf-8.spl" or "es.ascii.spl"

Steps To Reproduce

Open neovim with repro file

Expected Behavior

When neovim is first run, the spellfile for the spanish language doesn't exist so the spellfile.vim plugin is triggered and it should download the corresponding spellfile, so the spelling works correctly both in Spanish and English.
Then the next time neovim is opened the spelling stills works correctly.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name

end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {

  "folke/tokyonight.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",

})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

vim.opt.spell = true
vim.opt.spelllang = "en,es"

-- Esto es un texto de prueba en Espa├▒ol
-- This es a test text in English
@SGman98 SGman98 added the bug Something isn't working label Mar 19, 2023
@folke
Copy link
Owner

folke commented Mar 19, 2023

Make sure to comment "netrwPlugin" in lua/config/lazy.lua if you want NEovim to automatically download spell files

@folke folke closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2023
@folke
Copy link
Owner

folke commented Mar 19, 2023

Also, make sure stdpath('data').'/site/spell' exists

@mlen
Copy link

mlen commented Mar 28, 2023

Re #677 (comment): For me it doesn't work with that line commented or uncommented.

The directory exists and downloading works when I run nvim -u /dev/null to prevent it from using my config.

I added vim.cmd.echo('split(globpath(&rtp, "spell"), "\n")'), so part of the actual logic for finding spell directories, to my configuration to see this output

before lazy setup: ['/home/user/.local/share/nvim/site/spell', '/nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/spell']
after lazy setup: ['/nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/spell']

Looks like lazy setup filters out some of the rtp, which removes user-writeable directories from it and in turn triggers the issue described above. Neovim then correctly recognizes that there are no writable directories available.

Can you please reopen this issue, to me it looks like a bug.

@SGman98
Copy link
Author

SGman98 commented Mar 28, 2023

I found the solution by looking through the issues again, it seems the problem was the runtime path.

As Lazy reset the rtp by default the spell folder seems to be ignored.

Using the code in here solves the problem: #64 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants