SlickEdit Product Discussion > SlickEdit®
How to highlight matching words in CMakeLists.txt file?
rowbearto:
In C/C++ I have it setup such that when I have the cursor in a particular symbol that all the identical symbols in the same file are highlighted.
I can't find how to set this up for CMake files? There is no "Context tagging" area in the tools menu for cmake.
I realize I could use the new tool window for highlighting, but that has the drawback that I have to enter into there which word to highlight. I'd rather just left click into a word and have it highlighted everywhere instead of having to enter it into some tool window.
So how to do this for CMakeLists.txt?
Dennis:
A solution that will work for you sometimes is to use references. If the word you are trying to highlight is not defined somewhere in your project, you will get a prompt like this:
============================
Symbol 'HWScripts' not found.
Do you want to search for word matches?
[ ] Always ...
[OK] [Cancel]
=============================
"words" in this case are going to be defined by identifier characters in the CMake mode color coding (not word-chars), because references works with symbols not fuzzy concepts like words. Hit OK, and all the instances of that symbol the current file will be highlighted as a reference. Of course, as always, Ctrl+, to pop out of the references scope.
Your next best bet would be to bind "highlight-toggle-word" to a key and use it to quickly flip highlighting on and off for various words. It will also work with a selection, so you do not have to strictly highlight words. A big advantage to using highlight is that the word highlighting will work across all of your CMake files.
rowbearto:
Using find references does not highlight the word, it lists it in references. I am asking for highlighting.
highlight-toggle-word is nice and does what I want, but it is an extra step, need to hit the bound key or run the command instead of just clicking on the word as I'm used to in C/C++. A colleague here was showing off how another IDE highlights the matching word just with left-click no matter what the file type - unfortunately SE doesn't.
Would like to make a feature request for this - it doesn't seem too hard? Do I need to make another post in the "Features and/or Improvements" thread to request it, or is this post sufficient?
EDIT: I see another problem with highlight-toggle-word, how to easily turn off this highlight when I left click somewhere else? The highlight is still there when I click on something else?
LBCEi:
How did you get SE to do that in C/C++? I've been wishing for that feature as well.
rowbearto:
I did these settings long time ago, so I may not remember exactly.
In the "Context Tagging" options for C/C++ I checked "Highlight matching symbols under cursor"
In Tools->Appearance->Colors under Highlighting->Symbol Highlight, you select the color to show this highlight as. Here it states:
--- Quote ---This color is used to highlight other references to the symbol under the cursor. This color is only used if highlight matching symbols is enabled for the current language
--- End quote ---
Unfortunately you can't enable "highlight matching symbols" for a language that doesn't have "Context Tagging" options, as that is where this option is. So I can't do this for CMake.
I'd rather a global option for this anyway, and not have per-language settings.
Navigation
[0] Message Index
[#] Next page
Go to full version