From 9cc8de31b36a06ccf293aad2c745544d3ab0a1f3 Mon Sep 17 00:00:00 2001 From: Sandro Heinzelmann Date: Thu, 6 May 2021 20:00:22 +0200 Subject: [PATCH] Document snippet arguments --- README.md | 13 +++++++++++++ snippet_sample.yml | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e7d4b3c..50467bd 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/snippet_sample.yml b/snippet_sample.yml index 8470765..3d81bc1 100644 --- a/snippet_sample.yml +++ b/snippet_sample.yml @@ -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" \ No newline at end of file +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] \ No newline at end of file