Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new package added: verbose-form-template #85

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions packages/espanso-verbose-form-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Espanso Choice Extension Shortcut

> This package allows you to quickly create a new espanso shortcut with the choice extension. Please see the example below.


## Usage

Let's say you want to create a new espanso shortcut that will allow you to choose between different options such as a list of colors that you frequently use in styling. Or you have a list of co-worker logins that you need to use but can't always remember off hand. You can use the choice extension to quickly generate a shortcut template that you can customize to give you a list of options to choose from.


Please see [![espanso-verbose-form-template](https://img.youtube.com/vi/videoid/0.jpg)](https://www.youtube.com/watch?v=VEGv4aHV1d8)
for a short video demo


```yaml

# Example usage

- triggers: ['csscolors--', 'csscol--']
replace: "color: {{CSS.color_name}}"
vars:
- name: "CSS"
type: form
params:
layout: "color_name: [[color_name]]"
fields:
color_name:
type: list
values:
- red
- orange
- black
- white
- green
- blue
- purple
- pink
- yellow
- brown
- gray
- cyan
- magenta
- lime
- teal
- indigo
- violet
- fuchsia
- aqua
- maroon
- navy
- olive
- silver
- limegreen
- skyblue
- tan

```

## Source

Please refer to the awesome documentation for verbose syntax forms here https://espanso.org/docs/matches/forms/#controls-with-the-verbose-syntax

![espanso-choice-extension-template](./verbose-form.jpeg)


## Notes

I added manual unicode value for white space `\u0020` and `\n` for new line. This is because I had issues with vscode settings interfering with my YAML spacing and I found that just writing shortcuts like this was easier.
7 changes: 7 additions & 0 deletions packages/espanso-verbose-form-template/_manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: espanso-verbose-form-template
version: 1.0.0
author: Omar Elmenawi
description: Espanso shortcode to create espanso shortcuts with the choice extension
tags: ["espanso", "shortcut", "template", "choice-extension"]


25 changes: 25 additions & 0 deletions packages/espanso-verbose-form-template/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
matches:

- trigger: 'verboseform:'
replace: "\u0020\u0020-\u0020triggers:\u0020['{{FORM.trigger}}']\n\u0020\u0020\u0020\u0020replace:\u0020\"{{FORM.replace}}\u0020{{{{FORM.form_name}}.{{FORM.variable}}}}\"\n\u0020\u0020\u0020\u0020vars:\n\u0020\u0020\u0020\u0020\u0020\u0020-\u0020name:\u0020\"{{FORM.form_name}}\"\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020type:\u0020form\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020params:\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020layout:\u0020\"{{FORM.variable}}:\u0020[[{{FORM.variable}}]]\"\u0020\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020fields:\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020{{FORM.variable}}:\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020type:\u0020list\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020values:\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020-\u0020{{FORM.list_option_one}}\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020-\u0020{{FORM.list_option_two}}\n\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020-\u0020{{FORM.list_option_three}}"
vars:
- name: "FORM"
type: form
params:
layout: "Form_Name: [[form_name]] Form_Trigger: [[trigger]] Form_Replace: [[replace]] Form_Variable: [[variable]] Form_List_Option_One: [[list_option_one]] Form_List_Option_Two: [[list_option_two]] Form_List_Option_Three: [[list_option_three]]"
fields:
form_name:
trigger:
variable:
replace:
var_type:
list_option_one:
label: "Espanso: Form - Verbose"
description: |
- Allows you to specify :
- form name
- trigger
- variable
- replace
- three starter list options

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading