I am looking for a text editor (best would be an Eclipse plugin) which lets me highlight source code lines automatically (programatically) according to a set of given line numbers.

Say, I have a file src.java and the set { 3, 18, 19, 20, 101, ... } which might represent thousands of source code lines.

How to highlight them automatically via program code?

  • 1
    How do you want to provide these information? Is it okay if you have to jump to the relevant line and klick on "highlight here" or do you want the program to read this information from a meta file? Also, out of curiosity, why exactly do you want to do this? Commented Oct 23, 2014 at 10:41
  • I'm realt curious as to why you want to do this. I have no direct answer to your question but with some more details then maybee I could come up with something.
    – Spade
    Commented Oct 27, 2014 at 17:33

2 Answers 2


You can use Netbeans to achieve this result.

Open your source file in it and navigate to the appropiate lines using

CTRL+g 3

Then you mark the line as bookmark like this:


That way you get blue markups on the left with the bookmarked line.

screenshot with markings

In this screenshot I have bookmarked lines 28 and 37.

You can then access the bookmarks with


and thus jump from one to the other.

If you want to have more visual highlighting you can set it in

Tools -> Options -> Fonts & Colors -> Annotations -> Bookmark

In the following screenshot I set it to cyan:

with line highlight

Unfortunately I don't know how to import or export the bookmarks in bulk.

If you want to know about all your bookmarks you can do so by activating the Bookmarks View in:

Window -> IDE Tools -> Bookmarks

There you can also configure hotkeys for this specific bookmark and then reach it via CTRL+2xg HOTKEY

  • Hi @Angelo thank you for your answer. Unfortunately, I forgot to mention an important requirement: I have lots of lines and I want to highlight them automatically via program code. Commented Oct 23, 2014 at 12:56
  • iirc one can script Netbeans, I'll have a look into it. Commented Oct 23, 2014 at 13:02

SynWrite editor. Open Console pane (Ctrl+tilde), enter this script (2 lines one by one)

from sw import *
for i in [3, 10, 15, 17]: ed.set_bk(BK_SET_UNNUM, ed.xy_pos(0, i-1))

this places highlight on lines 3,10,15,17
(screenshot taken for little shifted numbers).

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.