obsidian-editor-shortcuts
obsidian-editor-shortcuts copied to clipboard
[Feature Request] New Command: Select Word (Not Select the Next Occurrence)
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
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
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
https://user-images.githubusercontent.com/85180696/174653195-df0f4835-57c7-46a0-a7ff-9d8b3a5a2945.MOV
Why I need a separated Command ?
The video below shows why I need a command to only Select one Word
📽 3x Michael Jordan
https://user-images.githubusercontent.com/85180696/174653417-a6eb4003-484c-41ec-a80a-014f4f8b87d2.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 🌞
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)
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 :(
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 👍
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
?
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
andactions.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
andactions.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 :)
No problem! I'll message you on Discord about it.
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!