Relative Line Numbering

Let’s face it — there’s something comforting about having line numbers displayed when editing text.  It aids in debugging failures, it helps gives us a sense of where we are, and it even feels good to hit the return key at the end of a file and see the line number increase, giving us a feeling of accomplishment.  All code editors have line number support as a result.

Vim not only has support for line numbers but they also have support for something called relative line numbering.  TKE has this feature as well.  Relative line numbers track the current insertion cursor.  Whereever the insertion cursor is, that line is numbered ‘0’.  The lines above the insertion cursor are incrementally increased from 0 while the lines below the insertion cursor are also incrementally increased from 0 as can be seen in the image below.

What is relative line numbering good for?

Relative line numbering is especially useful when operating in Vim mode as it allows aids commands like yanking, cursor movement, and the like.  For example, if I want to move the cursor from its current position to the line containing the first “interp” line in the image above, I don’t have to manually count the lines, I can simply enter ‘7j’ as I can quickly reference the relative line number of the first “interp” line.

How can I enable it?

If you always want line numbering to start as relative, you can set the Editor/LineNumbering preference value to “relative”.  If you want to change the line numbering scheme in the current editing buffer, you can use the “View/Line Numbering” menu option to switch between “Absolute” and “Relative”.  Additionally, you can use the Vim command “:set rnu” to use relative line numbering or “:set nornu” to use absolute line numbering.

Just another way that TKE has your back!

To see more information and download your copy of the TKE code editor, visit http://tke.sourceforge.net

Advertisements
Relative Line Numbering