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

[Feature Request] New Command: Select Word (Not Select the Next Occurrence) #39

Closed
FelipeRearden opened this issue Jun 20, 2022 · 6 comments

Comments

@FelipeRearden
Copy link

FelipeRearden commented Jun 20, 2022

Hello @timhor !!!!

A brief introduction before talking about the FR :)

1️⃣ In version 1.0.7 we had the command Select Word that selected the word based on the caret cursor position.

2️⃣ In version 1.0.8 this command gains superpower which lets us select word and select the next occurrence as well :)

  • Which is an amazing feature !!!!!

My FR is about bring back the Select Word in a separated command

  • This way we can have the option two use both commands for different workflows :)

I know that look strange to have two commands like this. Let me show how Select Word can have multiple workflows when you combine with other plugins :)

My Workflow

ℹ️ I import a lot of content to Obsdian. Especially Book Highlights, Podcasts Transcriptions and Web Artciles

ℹ️ All my writing is created inside Obsidian. Even when I have to send a message, I write first in Obsdiamn than send to external sources.

ℹ️ Additionally, I use a lot of html tags to decorate my notes.

📸 Source Mode x Reading Mode
4B7AB918-2ECC-4912-A33F-038F4DDABF27

This way I use a lot of Line Selection, Paragraphs Selection and Word Selection to easily apply this decorations to my notes.

  • Using QuickAdd I can create a macro to apply these text decorations.

📸 This is my QuickAdd Macro
B3EBF8E1-02C7-48A1-975C-01C0FC71AD3F
48E65BAA-54D9-4EB9-990F-F79C132E2C3F

This Macro automatically Select the word at the caret cursor and then apply the decoration.

The beautiful thing here is that the command respects if something where already select

  • This is amazing because I can have one hotkey to deal with selected and NOT select words;

📽 2 Selected Words Selected

IMG_0578.MOV

Why I need a separated Command ?

The video below shows why I need a command to only Select one Word

📽 3x Michael Jordan

IMG_0579.MOV

In words: when I have two words select and I have the same words before and/or after the command Select Word and the Next Occurrence will apply the decoration to the next other matches

  • Which is perfect ! It exactly what the command should do :)

But when we have a workflow where we want to apply some type of rule (in my case html tags) only to the select text and avoid the next occcurance I can use the same command.
-The best scenario for this would be the old command that only selects one Michael Jordan :)

We can apply this same insight to many workflow in Obsidian, I decided to share this one because its easy to see :)


Thanks for reading this !!!!! I hope you like my suggestion 🙏 🙏 🙏

Sorry for the long text. My idea was to show to you that a isolated command is something really important :)

Let me know if you need more information !!!

Have a great day 🌞

@timhor
Copy link
Owner

timhor commented Jun 23, 2022

Thanks for the detailed explanation 🙂 this issue seems like it could be solved with a slight change to your workflow though?

If I'm understanding correctly, the difference in behaviour is because in the first case, you're using the QuickAdd macro with a cursor selection, whereas in the second case, you're using it after selecting the text yourself via the keyboard.

What if you change the macro to only perform Apply u tag? Then you can have more flexibility with the content you wish to apply it to. Some examples:

  • Select word with Ctrl+D and then run the macro
  • Select line with Ctrl+L and then run the macro
  • Select part of line with Shift + arrow keys and then run the macro

Or if you really want to keep one where it expands to the current word, maybe create another version of the macro to do that.

(I'd also prefer to avoid keeping and maintaining bespoke commands where possible)

@FelipeRearden
Copy link
Author

Thanks for the detailed explanation 🙂

💙 and thanks for using your time to reply and to suggest a different approach :)

If I'm understanding correctly, the difference in behaviour is because in the first case, you're using the QuickAdd macro with a cursor selection, whereas in the second case, you're using it after selecting the text yourself via the keyboard.

100% Correct.

The command Select Word would select a word when the caret cursor is placed between two characters AND keep the selection if something was already selected.

This way I had four situations covered:

  • Nothing Selected with the caret cursor placed between two characters;
  • 1 word select;
  • 2 or more words selected;
  • Nothing Selected with nothing near the caret cursor -> QuickAdd opens a modal for me to type the words and apply the decoration.

This way I could have one hotkey for 4 workflows different workflows.

this issue seems like it could be solved with a slight change to your workflow though?

I really appreciate the suggestion. Some info just to see the problem is a more dangerous than looks :)

I have 8 commands with this behavior. I don't have more hotkeys :(

19943E89-66F4-46C5-8B6A-2E7BC2483A05

What if you change the macro to only perform Apply u tag? Then you can have more flexibility with the content you wish to apply it to. Some examples:

I already have hotkeys that only applies to situations where I need to apply the decoration to the Selected Line.

ℹ️ As you know I use your other command Select Line to apply the decoration to the line instead to words.

Or if you really want to keep one where it expands to the current word, maybe create another version of the macro to do that.

(I'd also prefer to avoid keeping and maintaining bespoke commands where possible)

Before creating this FR I tried for weeks everything possible to avoid creating this FR (Templater, Shell Commands, changing the Macro) but we don't have another plugin that selects the word, just yours used to be.

That's why I put a lot ❤️ to create an detailed FR that would show to you how this new command is important to workflows that rely on selection as the first step of a command with multiples step.

You were my last chance :)

I created the FR and 🙏 for Obsidian gods for an answer :)

(I'd also prefer to avoid keeping and maintaining bespoke commands where possible)

100% understood 👍

@timhor
Copy link
Owner

timhor commented Jun 25, 2022

I see, I appreciate the effort you went to in trying to find workarounds! I'll revisit this if there ends up being more demand for it, or at least after I've addressed some of the other pending feature requests first.

For now – the select word command was updated in c88b861. Could you potentially look into changing your copy of the plugin by restoring the deleted lines in main.ts and actions.ts?

@FelipeRearden
Copy link
Author

I see, I appreciate the effort you went to in trying to find workarounds! I'll revisit this if there ends up being more demand for it, or at least after I've addressed some of the other pending feature requests first.

I really appreciate @timhor for some hope in the future. Thanks for caring @timhor ! It means a lot

Could you potentially look into changing your copy of the plugin by restoring the deleted lines in main.ts and actions.ts?

I am not a developer but I am a hard worker. If you give some guidance and help on how to do this I will try my best.

My questions from my first attempt:

1️⃣ Restore = addition ?

by restoring the deleted lines in main.ts and actions.ts

Do you mean by this that I have to ADD the red lines without EXCLUDE of the GREEN lines ?

2️⃣ How to find main.ts and actions.ts?

On my end (my plugin folder) I only have .js files

Forgive for my lack of knowledge :)

@timhor
Copy link
Owner

timhor commented Jun 28, 2022

No problem! I'll message you on Discord about it.

@FelipeRearden
Copy link
Author

No problem! I'll message you on Discord about it.

Thank you very much @timhor !!!

I got your message on discord and I will reply there!

@FelipeRearden FelipeRearden closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2023
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

2 participants