Skip to content

Commit

Permalink
docs: update after long time
Browse files Browse the repository at this point in the history
  • Loading branch information
cvigilv committed Sep 22, 2024
1 parent f9df426 commit 6628200
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 20 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Reduce your boilerplate code the lazy-bones way.
## What is `esqueleto`?

<p align="center">
<img width="66%" src="https://github.com/cvigilv/esqueleto.nvim/assets/30091515/f3b783f2-2da8-49ae-9ac1-96141bb0b00b">
<img width="66%" src="https://github.com/cvigilv/esqueleto.nvim/assets/30091515/f3b783f2-2da8-49ae-9ac1-96141bb0b00b">
</p>

`esqueleto.nvim` is a lua-based plugin that intends to make the use of templates
Expand Down Expand Up @@ -154,7 +154,7 @@ The default options of `esqueleto` are the following:
autouse = true, -- whether to auto-use a template if it's the only one for a pattern

-- Wild-card options
wildcards = {
wildcards = {
expand = true, -- whether to expand wild-cards
lookup = { -- wild-cards look-up table
-- File-specific
Expand Down Expand Up @@ -193,7 +193,7 @@ For more information regarding `esqueleto.nvim` options, refer to docs (`:h esqu


### Triggers
As previously showcased, `esqueleto.nvim` has two types of triggers: (i) file type and (ii)
As previously showcased, `esqueleto.nvim` has two types of triggers: (i) file type and (ii)
file name triggers. This correspond to the backbone of `esqueleto`, therefore is essential to
correctly understand how the plugin works for proper creation and organization of templates.

Expand Down Expand Up @@ -221,7 +221,7 @@ require("esqueleto").setup(
)
```

Then, instead of creating a new file, we will create a softlink to the template we already
Then, instead of creating a new file, we will create a softlink to the template we already
have in the `python` directory. From this, we should obtain the following structure:

```
Expand All @@ -239,7 +239,7 @@ and now we will trigger template insertion for empty (i) `python` type, (ii) `LI
(iii) `cli.py` named files:

<p align="center">
<img width="66%" src="https://github.com/cvigilv/esqueleto.nvim/assets/30091515/2bc174ca-7a76-4776-8d51-2fd1941091a1">
<img width="66%" src="https://github.com/cvigilv/esqueleto.nvim/assets/30091515/2bc174ca-7a76-4776-8d51-2fd1941091a1">
</p>

Finally, the command `EsqueletoNew` provides of a user-friendly way for creating new
Expand Down
64 changes: 49 additions & 15 deletions doc/esqueleto.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,57 @@ python:~
*functions*

*esqueleto.setup()*
setup({patterns}, {directory})
setup({config})

Setup for specific file {patterns} using the templates inside a
given {directory}.
Setup the plugin using the given {config} table.

Defaults: >
esqueleto.setup(
{
directories = {vim.fn.stdpath("config") .. "/skeletons"},
patterns = { },
advanced = { ignore = {}, ignore_os_files = true },
}
)
{
autouse = true,
directories = { vim.fn.stdpath("config") .. "/skeletons" },
patterns = function(dir) return vim.fn.readdir(dir) end,
wildcards = {
expand = true,
lookup = {
-- File
["filename"] = function() return vim.fn.expand("%:t:r") end,
["fileabspath"] = function() return vim.fn.expand("%:p") end,
["filerelpath"] = function() return vim.fn.expand("%:p:~") end,
["fileext"] = function() return vim.fn.expand("%:e") end,
["filetype"] = function() return vim.bo.filetype end,
-- Date and time
["date"] = function() return os.date("%Y%m%d", os.time()) end,
["year"] = function() return os.date("%Y", os.time()) end,
["month"] = function() return os.date("%m", os.time()) end,
["day"] = function() return os.date("%d", os.time()) end,
["time"] = function() return os.date("%T", os.time()) end,
-- System
["host"] = function() return utils.capture("hostname", false) end,
["user"] = function() return os.getenv("USER") end,
-- Github
["gh-email"] = function() return utils.capture("git config user.email", false) end,
["gh-user"] = function() return utils.capture("git config user.name", false) end,
},
},
advanced = { ignored = {}, ignore_os_files = true },
}
<

Parameters: ~
{patterns} (table) File names or patterns to match
{directory} (string) An absolute or relative path to the directory
with templates.
{advanced} (table) Advanced options, including:
{autouse} (boolean) Whether to auto-use a template if it's the only
one for a pattern.
{directories} (table) An absolute or relative path to the directories
with templates.
{patterns} (table) File names or patterns to match. File name
trigger has priority.
{wildcards} (table) Wildcards options, including:
{expand} (boolean) Whether to expand
wild-cards.
{lookup} (table) Wild-cards look-up table.
{advanced} (table) Advanced options, including:
{ignore} (table|function) List of glob patterns of
files to be ignored; alternatively, a
predicate that determines if a file
Expand All @@ -148,11 +179,14 @@ setup({patterns}, {directory})
*ex-commands*

*Esqueleto*
Esqueleto
EsqueletoInsert

Prompt template insertion for current file, prioritizing patterns matching
over file name then over file type.

EsqueletoNew

Prompt template creation for current file.

==============================================================================
*changelog*
Expand Down

0 comments on commit 6628200

Please sign in to comment.