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

FR Expand with spacebar #6

Closed
Jopp-gh opened this issue Jul 17, 2022 · 5 comments
Closed

FR Expand with spacebar #6

Jopp-gh opened this issue Jul 17, 2022 · 5 comments

Comments

@Jopp-gh
Copy link

Jopp-gh commented Jul 17, 2022

How about adding the spacebar button to expand strings ? Space is super easy, quick and intuitive to activate

Closing with symbols or punctuation is too "complicated"

@jon-heard
Copy link
Owner

jon-heard commented Jul 18, 2022

I'll consider how I might accomplish this, but defining a shortcut text's end point is kind of required at the moment (thus the punctuation).

Shortcuts can include multiple words, optional text and even user-defined text. This allows for shortcuts like "fate impossible" and "set name Jon Smith". Unfortunately, that flexibility makes it hard to determine the ending of a shortcut text.

For example: If valid shortcut texts include "list" and "list all" and "list all people", at what place should a shortcut expansion take place? I could just expand as soon as I recognize a completed shortcut text ("list" in this example), but it definitely limits the shortcut options.

Things gets more tricky if the shortcut text ends in a user-defined text, such as "set name Jon Smith". I COULD require that shortcut text NOT end in user-defined text. Maybe the user has to add a non-custom character, but then we're back to ending a shortcut with punctuation.

@jon-heard
Copy link
Owner

jon-heard commented Jul 18, 2022

I suppose that I could expand the shortcut as soon as it is recognized OR expand it on the closing punctuation if it ends with user-defined text. This would still incur the "list", "list all", "list all people" issue, but perhaps that's not so terrible.

This would be pretty complicated to implement, though, and the outcome of letting the user type one fewer characters on most, but not all, shortcuts seems... minimal?

Sorry. If a lot of people really want this, then I'll seriously consider it.

@enly1
Copy link

enly1 commented Jul 20, 2022

The other text expander plugin you referenced has the ability to expand as follows:

:Trigger<Tab>

This seems very intuitive and far less likely to exist in a trigger than the space discussed above.

:time<tab> => 12:32

Just a thought

@jon-heard
Copy link
Owner

jon-heard commented Jul 21, 2022

@johans3: It just occurred to me that if you set the suffix character (in the settings) to be a single space, rather than a single semicolon, then you get exactly the feature you are asking for. If you are simply using shortcuts that you've written for yourself then this is a perfectly viable solution. Unfortunately, the library has many shortcuts that contain space characters. I opted to end shortcuts with a semicolon by default as it's a less common character than space, while still being nearly as easy to type (pinky vs thumb).

One thing I could do would be to add a feature to Text Expander JS that lets you replace any spaces in shortcuts with a different character. Semicolon is a good choice as it's still the easiest non-alphabet / space character to write. Semicolon would be ugly, IMO, but maybe you wouldn't mind?. This feature would allow you to type any shortcuts from the library, while still using the space key to end/expand each shortcut.

As an example, the shortcut text ;;une character; could, instead, be written as ;;une;character with a space at the end to trigger the expansion. Another option would be a period: ;;une.character. Heck, you could even just do away with spaces altogether: ;;unecharacter.

Let me know what you think about all of this.


@enly1: You can certainly set a colon to be your prefix if you wish, though I find the semicolon less effort to type. Unfortunately, tab is a special key in Obsidian: it indents a line, even if the carat is not at the beginning of the line. This means that tab keystrokes aren't sent to plugins as a normal keystroke... at least as far as I can tell. If you know of a plugin that uses tab keystrokes, then let me know and I'll check it out.

@jon-heard
Copy link
Owner

I've added a discussion here to discuss this topic with the community. Feel free to chime in there.
Since, I've effectively moved this issue to that discussion, I'm going to close it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants