The Formats file

The formats.toml file is for dealing with your bookmarks that have got file extensions but with no handler. In other words, it provides the default file handlers for matching bookmarks.

For example, if you have this in your bookmark file:

project-plan <~/Documents/Projects/music-interpretations.plan>

hlg does not know how to handle a .plan file. So even though the handler field is not mandatory, in this case, hlg will have no way to launch such a bookmark even though a full path is provided.

To solve this problem, you can simply do either of the two ways:

  • either provide a handler in the handler field to launch this bookmark; or

  • Just enter a plan format in the formats.toml along with the program that can launch this type of file.

If you open your formats.toml file, you will see sample entries which you can add or remove.

The syntax for entering your format is as follows:

program = [formats]

This means that each line starts with the name of the program, then an equal sign (=) then a list of formats which the program can handle.

This list is entered inside square brackets.

You have to provide the format in quotation marks, and separate each item in the list by a comma. For example:

emacs = ["org", "md", "asciidoc", "plan"]

This results in any of the matching file extensions — .md, .asciidoc, .org, .plan — in your bookmark file without a handler, in emacs being used.

In the list of file formats, do not add the . prefix to indicate that this is a file extension.

Simply enter the file format without the period. Entering a period like this .txt for plain text files will result in hlg failing to resolve extensions that end in .txt

So enter file extensions as bare names as shown in this example instead.

To edit the formats file

To edit your formats file, simply call hlg with the --edit-formats or -f option.

You can add or remove any programs along with its suggested file formats.

Just like with the main configuration file, remember to save after making any changes.