Kungsgeten / yankpad

Paste snippets from an org-mode file
MIT License
216 stars 18 forks source link

Have different keywords for the same snippet. #45

Closed phoenixanimations closed 6 years ago

phoenixanimations commented 6 years ago

I sometimes like to use a bunch of keywords for the same snippet as I don't know which keyword will stick in my head.

For example in csharp I have l, L, list, List all do: List<$1> $0 = new List<$1>(). I wouldn't mind the solution being something like:

* some-mode
** example1: this is main snippet
Hi how are you?
** example2: this is the child snippet.
:PROPERTIES:
:INHERENT: example1
:END:

Which would result in example1, and example2 expanding to Hi how are you?.

Kungsgeten commented 6 years ago

Looks like it could be useful! A problem though is that no other snippets right now use org-mode properties; all text below the headline is considered part of the snippet. I think this is useful if people want snippets for org-mode which inserts a specific set of properties, for instance.

An alternative solution might be to have a char as a separator for defining multiple keywords. Since we already have yankpad-expand-separator (which is : by default), perhaps that could be used. Then you could do something like:

* some-mode
** example1:example2: this is main snippet
Hi how are you?

What do you think?

Kungsgeten commented 6 years ago

I've added my alternative solution to the problem. You can now have several keywords by separating them with :. I hope that's ok!

phoenixanimations commented 6 years ago

Wow that was fast!

I only suggested properties because of categories, your solution is nicer as it's easier to type as well.

Kungsgeten commented 6 years ago

The required change was very small, and also I'm procrastinating from grading assignments :)

Actually properties might be used in the future for features which simply aren't possible just by adding all information in the snippet title or as tags. Probably then you'd need to add a :props: tag in order to use the properties.