highlight (hl)













SourceForge.net Logo




Keys used in highlight (hl)
In depth treating of used keys
Command line options

Keys used in highlight (hl)

Key Description
k or down moves one (logic) line down
j or up moves one (logic) line up
n or pagedown moves one page down
p or page up moves one page up
/ or f entering (f)inding dialog
a find (a)gain
g entering (g)oto_line dialog
o (o)pen new file in this buffer
r (r)eload file
F1...F12 switch to buffer 1 to 12
i (i)nfo screen (tells you in which buffers th files are)
e (e)xport source as HTML
h (h)elp screen (lists keys)
(, ), {, }, [, ], <, > finds the corresponding bracket of the top line
q quit the program

In depth treatment of used keys

Navigation: (up/down, pgup/pgdown, j/k, n/p)

As you have probably noticed in the key-table above there are two ways of navigating through the file: the standard up/down and pgup/pgdown keys and the vi(m) keys 'j'/'k' and (not vim keys) 'n'/'p'. This is primarily done for terminals which don't support arrow keys (yes, such terminals exist!) For example if you make a remote login on a different system (such as windows to unix or linux to unix) then it can happen, that the arrow keys don't work properly. Therefore it is a good job to have an alternative that should always work.

Finding: (f, /, a)

You can enter the dialog in two different ways: either pressing 'f' or '/' which is on unix systems more common as less and vi(m) work with this key. In either case you enter the same dialog.
Notice that this could change in future versions. As highlight supports only simple expression search at the moment in a future version one key could be a (fast) simple search whereas the other will treat regular expressions (wildcards * ? and so on).
The dialog: you can line edit your search pattern using the del/backspace and left/right-arrow keys. Notice that the end and home keys do not work.
If you want to exit the dialog without searching you must hit the backspace key at the beginning of the input field. Then in automatically drops out of the dialog.

When hitting the 'a' key the search pattern is searched again.
The pattern will always be highlighted in the top line of the terminal.

Going to a line number: (g)

When hitting the 'g' key you enter the line number dialog. Again you can use the del/backspace, left/right keys to alter your input. If the line you entered is larger than the lines of the file then it jumps only to the last line. Also if the number is negative it jumps only to the first line.
Exiting withput jumping is achieved by hitting backspace at the beginning of the input field.

Open/reload: (o, r)

When hitting the 'o' key you enter the open dialog. Imput the filename you want to load and hit the 'return' key. In order not to write the whole filename highlight suppports bash-like tabbing. When entering the begin of the filename and then hitting the 'tab' key, it is filled up until either the minimal number of characters that two or more files share or if it is unambigous then it is completely filled up with the corresponding filename.
Changes in the filename can be made by using the del/backspace, left/right keys.
If you don't want to open the file simply hit the backspace key at the beginning of the input field. Then you automatically drop out of the dialog.
Notice that if there is another file in this buffer it will be flushed first. If you don't want this then switch first to an empty buffer (cf. Switching).

If a file has changed in the time after it has been loaded then hit the 'r' key to reload the file.

Switching to other buffers: (F1...F12)

If you have loaded several files then you can switch between them by hitting the F1 to F12 keys. If a buffer is empty then the status/information bar at the bottom shows 'empty buffer'.
For an overview you can question the information dialog.

Informations screen: (i)

If you don't know any more which files are loaded or where the file you want is, then hit the 'i' key. There appears a dialog which summarizes all buffers. If a buffer is filled then you see its size in bytes,  lines and filename. In the first row  is a star '*' which shows you the current buffer. In order to exit the dialog just hit any key.

Exporting to HTML: (e)

By hitting the 'e' key you export the current buffer to HTML-code. The new HTML file is created by replacing the dot '.' (if there is one) by an underscore and appending the ending '.html' to the filename. It is saved in the same directory as the source file. At the moment there is no way of changing the directory.
Example:  /home/user1/highlight.C -> /home/user1/highlight_C.html

Help Screen: (h)

If you want to look up the keys without exiting the program then hit the 'h' key. You can scroll with the up/down arrow keys. Any other key exits the dialog.

Finding corresponding brackets: ( (, ), {, }, [, ], <, > )

It often happens that you want to see a corresponding bracket. Simply make the line with the opening/closing bracket be on the top line. Enter the bracket you want and highlight shows the highlighted corresponding bracket. If there is more than one bracket of the same species on the top line you must enter the number you want in the succeeding dialog. Is the corresponding (opening) bracket offscreen then the program displays the (closing) bracket on the bottom line. Notice that there is no one-key go back then. You first have to use the pgdown-key to make it go on the top line, then hit the corresponding bracket.

Quitting the program (q)

You quit the program by hitting the 'q' key. You don't have to close (you even can't) any buffers. The program does the cleanup and releases them automatically.

Command line options

There are two command line options you can use:

1) pass the filenames you wish to view as command line arguments.

hl filename1 filename2 ... (maximally 12)

2) if you don't want to use the interactive tool but just export files as HTML (in batch processing) then use the option '-e' as first argument. The files are then generated and exported to the same directory as the source files (cf. Exporting to HTML)

hl -e filename1 filename2 ... (unlimited)

Notice that highlight is switching nevertheless into the ncurses-mode because in order to export to HTML the program is using some library functions which work only propperly in this mode.

Copyright © 2007 H.M. Singer