Skip to content

Commit

Permalink
Document snippet arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
sandro-h committed May 6, 2021
1 parent bcb6a47 commit 9cc8de3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ Snippets are stored in `snippet.yml` file, see [snippet_sample.yml](snippet_samp

Optional configuration is stored in `config.yml` file, see [config_sample.yml](config_sample.yml).

### Snippet arguments

Snippets can use arguments that you have to fill out before it is typed.
In this case:

1. When you press `enter` to select a snippet with arguments,
a new window pops up to fill out the arguments.
2. Use `up` and `down` arrows to jump between argument inputs
3. Press `enter` to confirm the arguments and type the snippet. Any empty arguments lead to empty replacements in the snippet.
4. Press `escape` to cancel and return to the main snippet window.

See the [snippet_sample.yml](snippet_sample.yml) for configuring a snippet with arguments.

## Development

```shell
Expand Down
10 changes: 9 additions & 1 deletion snippet_sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ lorem: |
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nulla dignissim dolor efficitur sem auctor pharetra.
Duis eu neque odio.
shebang: "#!/usr/bin/bash"
shebang: "#!/usr/bin/bash"

# A snippet with arguments.
# Arguments in the content must have curly brackets.
# You must list arguments explicitly in the args list, so that snippet
# does not treat unrelated {...} content as an argument.
docker bash:
content: docker exec -ti {container} bash
args: [container]

0 comments on commit 9cc8de3

Please sign in to comment.