Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xvzc/skeleton.nvim
Simply load your neovim templates with dynamically generated resources
https://github.com/xvzc/skeleton.nvim
neovim neovim-plugin template template-plugin
Last synced: about 1 month ago
JSON representation
Simply load your neovim templates with dynamically generated resources
- Host: GitHub
- URL: https://github.com/xvzc/skeleton.nvim
- Owner: xvzc
- License: mit
- Created: 2023-01-11T08:15:11.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-01T13:03:24.000Z (11 months ago)
- Last Synced: 2024-01-02T13:56:12.894Z (11 months ago)
- Topics: neovim, neovim-plugin, template, template-plugin
- Language: Lua
- Homepage:
- Size: 45.9 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
skeleton.nvim
Load your templates with custom defined variables or functions.
# Minimal configuration
```lua
use {'xvzc/skeleton.nvim',
config = function()
require('skeleton').setup({
template_path = vim.fn.stdpath('config') .. '/templates',
patterns = {}
tags = {
author = 'my-nickname'
}
})
end
}
```# Tags
## Built-in tags
There's a couple of built-int tags, you can also override those tags.
```
{{ author }} // This will be replaced with the output of 'git config user.name' or 'whoami', also you can replcae this tag with any other function or string values
{{ timestamp }} // The default format of timestamp tag will be '%Y-%m-%d %H:%M:%S' format.
```## Custom tags
You can use the custom tags with `{{ key }}` syntax in your template files, and it will be replaced with the values (or functions) when you call `load()` function.
```lua
{
tags = {
key1 = 'value1',
key2 = function()
return os.date("%Y-%m-%d")
end
}
}
```## Patterns
When using telescope, skeleton.nvim will basically give you the list of files that has same filetype as the current buffer,
but we can also set list of patterns for each filetypes, so that template files that have different filetypes can be listed.
```lua
{
patterns = {
javascript = { "*.cjs" }
}
}
```# Integration with telescope
Add the line below to the bottom of your Telescope config.
```lua
telescope.load_extension('skeleton')
```# Usage
```
:lua require('skeleton').load('/home/john/example.txt')
```
```
:Telescope skeleton load_template
```# Inspirations
- [template.nvim](https://github.com/glepnir/template.nvim)