GitHub

@@ -354,7 +354,7 @@ variable. A plugin will apply a template if you add the template name to the

354354355355

Available built in templates are

356356357-

- **source**: source each filename in a plugin.

357+

- **source**: source each file in a plugin.

358358

- **PATH**: add the plugin directory to the `PATH` variable.

359359

- **FPATH**: add the plugin directory to the `FPATH` variable.

360360

- **path**: add the plugin directory to the `path` variable.

@@ -364,7 +364,7 @@ As template strings they could be represented like this

364364365365

```toml

366366

[templates]

367-

source = { value = 'source "{{ filename }}"', each = true }

367+

source = { value = 'source "{{ file }}"', each = true }

368368

PATH = 'export PATH="{{ dir }}:$PATH"'

369369

FPATH = 'export FPATH="{{ dir }}:$FPATH"'

370370

path = 'path=( "{{ dir }}" $path )'

@@ -383,8 +383,8 @@ apply = ["PATH", "fpath"]

383383

```

384384385385

The `each` value, as used in the `source` template above, specifies that the

386-

template should be applied to each matched filename for the plugin. This

387-

defaults to `false`.

386+

template should be applied to each matched file for the plugin. This defaults to

387+

`false`.

388388389389

### Custom templates

390390

@@ -399,10 +399,9 @@ Plugins all have the following information that can be used in templates

399399

- **A directory.** In git sources this is the location of the cloned repository,

400400

for local sources, it is the directory specified. This directory can be used

401401

in templates with `{{ dir }}`.

402-

- **Zero or more filenames.** These are the matched files in the plugin

403-

directory either discovered using the the global `match` field or specified as

404-

a plugin option with `use`. These can be used in templates using `{{ filename

405-

}}`.

402+

- **Zero or more files.** These are the matched files in the plugin directory

403+

either discovered using the the global `match` field or specified as a plugin

404+

option with `use`. These can be used in templates using `{{ file }}`.

406405407406

You can use the following global information in templates

408407

@@ -415,7 +414,7 @@ directory. We could create a new template with name **function**, like this

415414416415

```toml

417416

[templates]

418-

function = { value = 'ln -sf "{{ filename }}" "~/.zsh/functions/{{ name }}"', each = true }

417+

function = { value = 'ln -sf "{{ file }}" "~/.zsh/functions/{{ name }}"', each = true }

419418

```

420419421420

It can then be applied to the plugin like this

Read the original on github.com ↗