cvigilv / esqueleto.nvim

Reduce your boilerplate code the lazy-bones way
MIT License
100 stars 7 forks source link

Fill in file contents when creating files from NvimTree #1

Closed Invertisment closed 1 year ago

Invertisment commented 1 year ago

I think you may want to provide a sample skeleton just to show how to add and use one. It will also allow to see that the plugin works out of the box without trying to make your own skeletons and failing.

I have this config:

require("esqueleto").setup(
    {
      -- Directory where templates are stored
      directory = "~/.config/nvim/skeletons/", --default template directory

      -- Patterns to match when creating new file
      -- Can be either (i) file names or (ii) extension globs.
      -- Exact file name match have priority
      patterns = { "README.md", "*.py", "*.hey", "*.hi", "LICENSE.md" }
    }
)

And I added these files:

> tree .
.
├── LICENSE.md
├── skeleton.hey
└── skeleton.my-test.hi

And I created .hey, .hi and LICENSE.md files via NvimTree and it didn't work.

But it works when I use :e LICENSE.md from command mode.

cvigilv commented 1 year ago

@Invertisment thanks for the issue, will check what's the problem with NvimTree specifically.

Was planning in adding a video demo of the plugin and a directory with community submitted skeletons, so that information should be up in the following days whenever I release version 0.0

Invertisment commented 1 year ago

Alright, thanks. Also thanks for the plugin.

Edit: this may also be an issue with NvimTree, because I found that if LSP server creates a file it doesn't display that file.

Invertisment commented 1 year ago

Also didn't you think about using this kind of config? https://zactyh.medium.com/custom-vim-skeletons-file-templates-c6fe771012b3 Why the plugin if this does the trick?

cvigilv commented 1 year ago

The plugin in its current state is a minimum viable product, it basically does what is showcased in the blog with some additional functionality for multiple templates per file type and file matching (README.md files, for example)

I intend on adding a roadmap in the future in order to have a reference in the functionality I would like this plugin to have, maintaining it minimal and modular.

I'll be adding some video examples to showcase the extra functionality this week, including some example templates in order to jumpstart the use of the plugin.

Thanks for the suggestions and for the blog URL, found some ideas there I might add to the plugin.