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

Expand selection to word/phrase/etc? #38

Open
dakrone opened this issue Jun 13, 2022 · 3 comments
Open

Expand selection to word/phrase/etc? #38

dakrone opened this issue Jun 13, 2022 · 3 comments

Comments

@dakrone
Copy link

dakrone commented Jun 13, 2022

I commonly use expanding selection in both Emacs and Intellij, for example, something like this (with the cursor and selection denoted by |):

testRegisteredDomainProcessor(buildEvent("goog|leapis.com"), "googleapis.com", null, "googleapis.com", null);
*expand*
testRegisteredDomainProcessor(buildEvent("|googleapis|.com"), "googleapis.com", null, "googleapis.com", null);
*expand*
testRegisteredDomainProcessor(buildEvent("|googleapis.com|"), "googleapis.com", null, "googleapis.com", null);
*expand*
testRegisteredDomainProcessor(buildEvent(|"googleapis.com"|), "googleapis.com", null, "googleapis.com", null);
*expand*
testRegisteredDomainProcessor(|buildEvent("googleapis.com")|, "googleapis.com", null, "googleapis.com", null);
*expand*
|testRegisteredDomainProcessor(buildEvent("googleapis.com"), "googleapis.com", null, "googleapis.com", null);|

It would be great if this worked for text also, for example, just expanding to the current word would be super helpful. Something like:

Hello. This "is so|me text. Yep."
Hello. This "is |some| text. Yep."
Hello. This "|is some text.| Yep."
Hello. This "|is some text. Yep.|"
Hello. This |"is some text. Yep."|
Hello. |This "is some text. Yep."|
|Hello. This "is some text. Yep."|

I picked the unit that made the most sense to me (word -> sentence -> quotes -> outside quotes -> enclosing sentence -> entire text), but even just having "expand to word" would be very useful.

Thanks for this plugin!

@timhor
Copy link
Owner

timhor commented Jun 15, 2022

Most of these are already supported by this plugin, for instance:

  • Word: Select word (from a cursor, it will expand to the current word)
  • Quotes/brackets: Expand selection to quotes or brackets
  • Entire line: Select line

For selecting sentences, you may find https://github.com/timhor/obsidian-sentence-navigator useful.

@dakrone
Copy link
Author

dakrone commented Jun 15, 2022

They are supported, but not unified under a single keyboard shortcut, for example, I can bind ^W to Select word and hit it to go from foo b|ar baz to foo |bar| baz, but then hitting it a second time does nothing (instead of expanding again to |foo bar baz| like I expect). I'd have to bind three different keystrokes rather than continually hit the same key, as other code editors' implementations work.

Is there a way to get it to progressively widen as I hit a shortcut repeatedly?

@timhor
Copy link
Owner

timhor commented Jun 16, 2022

Not at the moment, but I can look into how achievable that could be – follow along here: https://github.com/timhor/obsidian-editor-shortcuts/projects/1#card-83261606.

As a first step, I'd like to get quotes and brackets incrementally expanding, as discussed in #21. That should hopefully pave the way for other types of expansions.

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