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

add option to add custom directories to runtime path #64

Closed
max397574 opened this issue Dec 21, 2022 · 22 comments · Fixed by #55
Closed

add option to add custom directories to runtime path #64

max397574 opened this issue Dec 21, 2022 · 22 comments · Fixed by #55
Labels
enhancement New feature or request

Comments

@max397574
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I use cheovim and it doesn't work because only my config folder but not ~/.config/nvim is added to runtime path.

Describe the solution you'd like
allow adding some directories manually to runtime path

Describe alternatives you've considered
don't use cheovim
(would be really sad)

Additional context
https://github.com/NTBBloodbath/cheovim

@max397574 max397574 added the enhancement New feature or request label Dec 21, 2022
@folke
Copy link
Owner

folke commented Dec 21, 2022

You can disable rtp reset with config.performance.rtp.reset =false
And then customize the rtp to your liking

@folke folke closed this as completed Dec 21, 2022
@max397574
Copy link
Contributor Author

I want to reset the runtime path though
and with that disabled I'd have to do all the resetting and readding myself
I think it would be much easier if you'd provide that option

@max397574
Copy link
Contributor Author

max397574 commented Dec 21, 2022

and I think it wouldn't be that hard to add this at the place where you modify the rtp

if M.options.performance.rtp.reset then

should be as simple as

if M.options.performance.rtp.custom_directories then
    for directory in M.options.performance.rtp.custom_directories do
        vim.opt.rtp:append(directory)
   end
end

if you'd make the default value {} you could even remove the if statement

@folke
Copy link
Owner

folke commented Dec 21, 2022

Added....

@max397574
Copy link
Contributor Author

thank you very much

@oblitum
Copy link

oblitum commented Dec 21, 2022

rtp resetting causes this problem, which can become a recurrent report here. Also, I'm not sure what's the best route for avoiding that while still resetting rtp.

@max397574
Copy link
Contributor Author

I don't understand the relation to this issue

@oblitum
Copy link

oblitum commented Dec 21, 2022

Your issue is due to default rtp reset. "spellfile#LoadFile(): No (writable) spell directory found." is not your issue, but cause is the same. Disabling rtp reset avoids the problem, but also throws the baby out with the bathwater.

@folke
Copy link
Owner

folke commented Dec 21, 2022

resetting does what the name implies. It removes any rtp directory except for your config, config/after, vim runtime. If someone does not want that behavior, they can simply disable the reset.

The spell directory normally resides in the user config directory, so it is already part of the rtp.

That issue's work-around doesn't make sense. Just create the directory in your config, no need to have it under share and then create a symlink

@folke
Copy link
Owner

folke commented Dec 21, 2022

Also, the issue you're pointing to is from 5 days ago. Lazy wasn't even publically available at that time, so totally unrelated.

@oblitum
Copy link

oblitum commented Dec 21, 2022

...

My experience.

I'm just migrating to "Lazy", never had an issue with spell files on packer. ~/.local/share/nvim/site/spell is the automatic path for spell file download, for nvim, and even, in the process, I found a mention of that path being hard coded in nvim (I didn't go about checking recent nvim sources though spellfile.vim#L200-L203).

I tried removing that path, so that I get a new download under Lazy, and other things: nothing works.

Nothing, except config.performance.rtp.reset =false, as commented above as solution to this current issue.

@max397574
Copy link
Contributor Author

then perhaps just do that?
setting the reset to false
or add this thing as custom directory like proposed in this issue

@folke
Copy link
Owner

folke commented Dec 21, 2022

I just added site to the rtp path. Should be fine. As long as it's not in the packpath

@oblitum
Copy link

oblitum commented Dec 21, 2022

Good, that should avoid it becoming a recurrent report + throwing the baby out with the bathwater.

@folke
Copy link
Owner

folke commented Dec 21, 2022

but how do you download the spell file? I never get the option. It just complains about the spell file not being found.

There's also no spellfile plugin, just the autoload

@folke
Copy link
Owner

folke commented Dec 21, 2022

image

@folke
Copy link
Owner

folke commented Dec 21, 2022

Removed it again from rtp, since it can download to your config just fine.

fyi: I didnt get the download option because I disabled netrw

@oblitum
Copy link

oblitum commented Dec 21, 2022

Right, this is done by netrw, as pointed by discussion in linked issues.

One can download to config, but that's a convention I'm coming to learn only now, never heard of it. By default, by removing site/ and having no spell files, and asked to download, nvim puts it on site/spell/ by default, and I suspect a lot of people just hit yes and don't customize any directory for it.

EDIT: IMHO, it's not quite right either. In my .config/nvim there's just configuration files, lua, json, etc. There's not a single blob file, which I don't see as pertaining to config.

@max397574
Copy link
Contributor Author

then just add the directory to the rtp with the option that was added on request of this issue
@folke perhaps disable comments here

@oblitum
Copy link

oblitum commented Dec 21, 2022

Surely I'm doing that already, given site on rtp has been reverted. FWIW, there's typos in the commit for this feature.

@adrian5
Copy link
Contributor

adrian5 commented Feb 8, 2023

Just ran into the spell issue as well. In case anyone else stumbles upon this, here's what I did:

  1. Briefly commented out the lazy.setup function, then triggered the dict download in vanilla nvim.
  2. Permanently added site/ path to rtp:
    require("lazy").setup("plugins", {
      performance = {
        rtp = {
          paths = { vim.fn.stdpath("data") .. "/site" }
        }
      }
    })

That seems to have solved it for me.

@jn64
Copy link

jn64 commented May 22, 2023

I ran into a similar problem trying to use the fzf.vim plugin included in Fedora's fzf package with lazy.

On Fedora 38:

  • neovim package's plugins are in /usr/share/nvim/runtime/plugin/.... With default lazy setup, these are loaded.
  • fzf package's plugin is in /usr/share/nvim/site/plugin/fzf.vim (and also in /usr/share/vim/vimfiles/plugin/fzf.vim). With default lazy setup, these are not loaded (understandable, but not obvious to me until I found this issue).

Setting performance.rtp.reset=false was overkill; lazy tries to load both copies of the fzf plugin. So the solution was to add just /usr/share/nvim/site to performance.rtp.paths.

Alternative solution was to symlink: ln -s ../../site/plugin/fzf.vim /usr/share/nvim/runtime/plugin/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants