Find All Occurrences Macro
-
I have a find all macro that works with hardcoded search string (TODO) but is there a way to create a macro that does find all for the current highlighted word?
This works for hardcoded “TODO …”:
<Macro name="TODO Find All" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="TODO:|BUG:|FIX:|REFACTOR:|DONE:|INFO:" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1636" sParam="" /> </Macro>
This does not work for the current word:
<Macro name="TODO Find All" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="$(CURRENT_WORD)" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1702" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1636" sParam="" /> </Macro>
Cheers.
-
@Michael-Vincent said in Find All Occurrences Macro:
is there a way to create a macro that does find all for the current highlighted word?
Sadly, no. Even more useful would be something like
$(PROMPT)
which would put up an input box for a user search term to be supplied. -
Hello, @michael-vincent, @alan-kilborn and All,
Michael, may be I’m missing something obvious !
Why don’t you use your macro, via its shortcut ( search of
TODO:|BUG:|FIX:|REFACTOR:|DONE:|INFO:
) to get one instance of the title, presently needed, and then, simply use theCtrl + F3
orCtrl + Shift + F3
shortcuts to move around to the next or previous similar title ?Best Regards,
guy038
-
@guy038 said in Find All Occurrences Macro:
Why don’t you use your macro, via its shortcut ( search of TODO:|BUG:|FIX:|REFACTOR:|DONE:|INFO: ) to get one instance of the title, presently needed, and then, simply use the Ctrl + F3 or Ctrl + Shift + F3 shortcuts to move around to the next or previous similar title ?
Thanks, and not to be rude, but that kind of defeats the purpose. Maybe I should have explained a little better. When I mean “Find all Occurrences” I want the search results window to pop up with all occurrences the same as when I:
- highlight a word
- press CTRL-F
- press “Find All in Current Document”
By making this a macro, I can then add it to the context menu and then a right-click on any word will have a click away, “Find All Occurrences” which will open the clickable search results window.
Hope that better explains, seems it may not be possible though. Shame the $(CURRENT_WORD) variable can be used in the shortcuts.xml file for the <UserDefinedCommands> commands section, but not the <macros> section.
Cheers.,