[ZeroBrane Studio] Re: Feature Request: Highlight Current Word

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Mon, 30 Mar 2015 15:26:35 -0700

Hi Derek,

> I would like to revive this feature request. It would be nice to have a 
> feature where you double click a word and it highlights all references in the 
> current editor.

Since the discussion is more than 2 years old, some of the features
that address the requirements in the original request have already
been implemented. For example, Ctrl-DClick will select instances of a
variable in a scope-aware way. There is also RightClick | Rename All
Instances, which does this for arbitrary text, but also allows the
editing of the text.

> I know you can sort of do it with the (cmd/ctrl)-double-click to rename all 
> references, but I think it would be useful to do it without the renaming 
> aspect.

There may be several options to extend this functionality, but I'd
like to figure out what's not sufficient (or what you don't like)
about the current one. For example, you mentioned that you don't want
renaming, but it doesn't get in a way much as the selection will
disappear when you move the caret anyway.

Also, it's not quite clear how exactly to highlight the matches. The
simplest way is to use multiple selection, which will disappear when
you move the caret. Another option would be to use indicators, which
are more permanent, but then it's not obvious when to clear them (need
another shortcut?).

What I may be able to do is to allow you to select a word, which would
trigger search of that word in the current document. I'll probably
make it available as a plugin to see how useful it is. Here is the
quick pass at that plugin
(https://gist.github.com/pkulchenko/70424f7660fb4465ae43); let me know
if that works for you. Note that it still does multiple selection; you
can disable cursor blinking with editor:SetAdditionalCaretsBlink(0)
and disable multi-cursor editing with
editor:SetAdditionalSelectionTyping(0).

Paul.

Other related posts: