Add a way to properly select a word and expand that selection (like expand_selection in Sublime Text) #42295
stiang
started this conversation in
Ideas From Sublime Text
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I think Zed really needs a better way to select a word, and (even better) expand that selection smartly, and (optimally) even be able to expand the selection to the larger syntax node after that.
Below is Sublime’s
expand_selectionin action. Note how the underscored part is considered one word and hyphened words are considered connected, but smartly expanded. Also, note how it doesn’t continue to expand the selection beyond the word boundary (would be even better if it did). Finally, note how the cursor is positioned at the end of the selected part.sublime_text_expand_selection.mov
VSCode and derivatives also support this very similarly to how Sublime does it (I can’t remember the command off the top of my head).
Zed has
Editor::select_larger_syntax_node, but this is an entirely different thing, as far as I can tell:oanddin:modein an Elixir file, it includes the:One can see how both approaches can have merit, but being fundamentally unable to select the current word (without punctuation, and regardless of context (like a quoted string)) feels like a real shortcoming for Zed. I use this all the time while editing, it’s one of my most used shortcuts (bound to
ctrl-w).The ideal solution, in my mind, would have the following characteristics:
Editor::expand_selectionEditor::select_larger_syntax_node)But I would be super-happy to just get a very naive version initially, that simply selected the word under the cursor (excluding punctuation) and placed the cursor at the end - nothing else. That would already be a huge improvement.
Am I the only one missing this?
Beta Was this translation helpful? Give feedback.
All reactions