-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Source lua files from plugin directories (and ftplugin, colors, etc) #12670
Comments
I can't remember if we said that it should take priority over
|
I think they should be treated independently ( (To be honest, I think the same argument could be made for |
I'm interested in this topic as well, RE: ftpluginAs brought up in #12378 (comment), ftplugin is merely syntactic sugar around Lines 11 to 35 in abdda66
How it works:
Extending this logic to search for a This is also how https://github.com/tjdevries/astronauta.nvim approaches this. diff --git a/runtime/ftplugin.vim b/runtime/ftplugin.vim
index a434b93..2877e77 100644
--- a/runtime/ftplugin.vim
+++ b/runtime/ftplugin.vim
@@ -29,6 +29,10 @@ augroup filetypeplugin
" "aaa.bbb" load "aaa" and then "bbb".
for name in split(s, '\.')
exe 'runtime! ftplugin/' . name . '.vim ftplugin/' . name . '_*.vim ftplugin/' . name . '/*.vim'
+
+ if filereadable('ftplugin/' . name . '.lua')
+ luafile 'ftplugin/' . name . '.lua'
+ endif
endfor
endif
endfunc @tjdevries WDYT ?
I agree that vim first, lua second is what I anticipate to be the expected order. I think it's up to plugin authors and users to ensure these configs don't conflict. |
I didn't know that lua configuration for ftplugin is already supported Reference → neovim/neovim#12670 (comment)
Splitting this out from #7895 (comment) since it's a separate issue.
Similarly to
init.lua
support, neovim should allowlua
files in user plugin directories ($XDG_CONFIG_HOME/nvim/plugin
,$XDG_CONFIG_HOME/nvim/ftplugin
, etc.) as well. This is particularly useful for pure lua plugins installed via native packages (e.g., through https://github.com/wbthomason/packer.nvim), since these packages -- even in/start/
-- are by default not sourced until afterinit.vim
(and, presumably,init.lua
once supported) is sourced. This means one would have to either manuallypackadd
each Lua package, or create a vimscript shim in$XDG_CONFIG_HOME/nvim/plugin
.As a starter, it would probably suffice to add a lua version after
neovim/src/nvim/main.c
Line 1350 in 326b87f
neovim/src/nvim/lua/executor.c
Line 1178 in 326b87f
@tjdevries
The text was updated successfully, but these errors were encountered: