Closed Invertisment closed 1 year ago
By default, an autocommand is created when running require("esqueleto").setup({})
, but this autocommand calls to a function called insert
that does all the handling.
You could call this function as follows in order to use esqueleto
on-demand:
require('esqueleto').insert("*.py") -- file extension matching
require('esqueleto').insert("README.md") -- file name matching
Now that you mention it, maybe it could be helpful to have the option to disable the creation of the autocommand by default in order to use esqueleto
only on-demand. I will add it to the plugin roadmap.
in order to use esqueleto only on-demand
That means that you won't really need to match the filetypes on you own :thinking:
So the config would be "out of the box" according to the filetype found in &filetype
I will implement an option to create the autocommand at setup
. This way, you can choose to either (1) use it as intended or (2) on-demand.
I will create some user commands also to make the calling on-demand of esqueleto
a little easier.
What do you think of:
Esqueleto # matches filename then filetype by default
Esqueleto <pattern> # matches the given pattern
For me anything works. I'm thinking whether I should use a snippet plugin but I have to trigger that one manually. But with auto command I could trigger it when the opened buffer is empty too :thinking:
And that could solve the issue when NvimTree opens a new buffer and it's empty.
esqueleto
to run in empty buffers not created by Neovim. So that should be solved briefly.
What do you think about extracting the autocmd function to be able to run it manually? I think this is not much work.
This can be done using
nvim.create_user_command
. Then you could call the fill-in function from command menu.