I suggest reading the help for ‘runtimepath’. (Neo)vim looks for configuration files in specific directories, which determine the order in which those files are loaded. You can place both .vim and .lua files in those directories, and .vim files will be loaded before .lua files.
For example, suppose you want to set some options for a plugin called foo
; if you place your configuration in ~/.config/nvim/after/plugin/foo.lua or in ~/.config/nvim/after/plugin/foo/bar.lua, neovim will load it automatically after foo
has been loaded (and it won’t load that configuration if plugins have not been loaded).
On the other hand, most options specific to a given file type, say tex
, go in ~/.nvim/ftplugin/tex.lua.