out-of-cheese-error / the-way

A code snippets manager for your terminal.
MIT License
352 stars 16 forks source link

are variables in code snippets supported? #113

Open Niedzwiedzw opened 2 years ago

Niedzwiedzw commented 2 years ago

I can't find anything in the docs

Ninjani commented 2 years ago

No, only in shell snippets. It would be difficult to support in code snippets I feel, as different languages use different syntax so would need to find something that works across all languages. Do you have an example of this behaviour from another program?

Niedzwiedzw commented 2 years ago

https://youtu.be/xmBovJvQ3KU?t=173 this guy shows how "yasnippet" handles this in emacs. it even supports some logic in templates (simple text transformations)

Ninjani commented 2 years ago

Interesting! I'm wondering how this would work on the command line though, since the-way is editor-agnostic. With single line shell snippets it's easy to display the whole snippet in the terminal and then list the variables to fill, this wouldn't work for the example in the video for instance.