Is there any way that i can select some words to be highlighted and their instances as well. This feature i especially used when viewing log files in Notepad++
-
1When you select a word, its occurrences are already highlighted. Or do you mean "select" them?– slhckSep 3, 2013 at 6:16
-
I just want to highlight them then move on with the cursor. Used to assist in viewing logs. Selection is sepearate– Basit AnwerSep 4, 2013 at 15:35
-
How do you mean "move on with the cursor"?– ruffinApr 27, 2017 at 22:35
3 Answers
Here are some useful key combos for selecting words in Sublime Text.
Ctrl⌘G - selects all occurrences of the current word (AltF3 on Windows/Linux)
⌘D - selects the next instance of the current word if it is already selected, otherwise selects the current word (CtrlD)
- ⌘K,⌘D - skips the current instance and goes on to select the next one (CtrlK,CtrlD)
- ⌘U - "soft undo", moves back to the previous selection (CtrlU)
⌘E, ⌘H - uses the current selection as the "Find" field in Find and Replace (CtrlE,CtrlH)
If you start with an empty selection, ⌘D and Ctrl⌘G will search by whole words automatically. If you start with a non-empty selection, it will search for any instance of the text (disregarding word boundaries).
-
2I just want to highlight them then move on with the cursor. Used to assist in viewing logs. Selection is separate Sep 6, 2013 at 14:53
-
1Agree. I don't need to select them all. Just want to double click to select a word then all occurrences are highlighted to help quickly examining the document. How hard is that? After 2 years seems that this one is still not fully implemented. Feb 14, 2016 at 16:01
-
It's possible, but just through the Find tool:
- select the desired word (double-click on it; or click on it and press ⌘D)
- open the Find tool (with ⌘F) and ensure Hightlight matches is selected
- navigate through the word instances (with ⌘G / Shift⌘G)
Or, as mentioned already, WordHighlight plugin would fit your specific need.
The native way is not as straightforward & fast as with the plug-in, but it's pretty fast anyway; with the benefit of not having the multiple highlighting always happening regardless you want it or not.
And double-click + ⌘F is fast enough for me 😉
Install this package in sublime text
https://packagecontrol.io/packages/WordHighlight
Add this content in the preferences -> package settings -> WordHighlight -> Settings User
{
"color_scope_name": "comment",
"case_sensitive": false,
"draw_outlined": true,
"mark_occurrences_on_gutter" : true,
// valid types: dot, circle, bookmark and cross
"icon_type_on_gutter" : "dot",
"highlight_delay": 0,
"highlight_when_selection_is_empty": false,
"highlight_word_under_cursor_when_selection_is_empty": false,
"highlight_non_word_characters": true,
"file_size_limit": 4194304,
"when_file_size_limit_search_this_num_of_characters": 20000
}