Hi,
I want to create my first plugin which is suppose to be a snippets library for LuaSnip,
and my idea is to put snippets for each file type in its own file in a directory like so:
init.lua -- require all snippets into luasnip table here
snippets_dir/ -- loop over all snippet modules in this dir
...
c.lua
lua.lua
python.lua
...
And then import each snippets file module in the main init.lua
file
Is there a way to get a list of these file paths / file names in nvim lua so
that I can require these in a loop and then insert eache filetype module into a table
correctly?
From what I understand there is a function called scandir in plenary.vim
that
would be nice to use but I am unsure if it works in a plugin when I don’t know
where the plugin will be located on a system since it takes a valid path
as
first param? So therefore I am was thinking that I should maybe use a relative
path for this in my plugin but that seems a complicated in lua at first glance?
Am I thinking correctly or is there a smarter way to do this? Can achieve my
goal with requiring all files in the snippets dir with scandir somehow?
I guess everybody doesn’t know or have used plenary (me not so much either) but
so the questino is then what type of path do I pass to scandir so that the plugin
will work with not just a single plugin manager with a fixed path?