In the Filetypes tab of the Edit preferences panel you can define all file types that should be recognized by bluefish.
The file types consist of:
a label (this label is also used in the file filters, and in the highlighting patterns).
a list of extensions, separated by a colon (:).
the highlighting update characters. Upon a key press of one of these characters, the highlighting engine will refresh the highlighting around the cursor. If this field is empty, any character will force the highlighting engine to refresh. Special characters like the tab and the newline can be entered as \t and \n, the backslash itself is entered as \\.
the icon location for this file type.
whether this file type is editable by Bluefish (whether or not Bluefish should try to open it after a double click).
a regular expression that can be used to detect the file type if a file without extension is loaded.
the auto-tag-closing mode. A value of 0 means that Bluefish should not close XML/HTML tags, a value of 1 means it should close the tags XML style (<br />), a value of 2 means HTML style.
You add, modify, delete, or move file types the same way it is described in Section 8.1, “Customizing browsers”.
Example VIII.1. Adding a file type
Let's say you use DocBook xsl stylesheets. Those files are recognized by bluefish as xml files, but they do not appear with the xml icon in the file browser as their extension (.xsl) is not listed in the Extensions field of the Filetypes tab of the Edit preferences panel.
On the other hand, adding them to the xml file type would impede to group them into a stylesheet filter, where they belong from a semantical point of view. And you cannot add them to the provided stylesheet filetype made for css stylesheet, since the highlighting patterns are different.
To add an xsl stylesheet file type, execute the following steps:
Click on the Preferences... icon in the main tool bar to access the Edit preferences panel.
Click on the Filetypes tab to display the Filetypes panel.
Click on the Filetypes part. A new line will be shown, with an Untitled label.
button in theDouble-click on the label to allow editing, and enter the string you want to appear in the xsl stylesheet
.
Click in the Extensions zone and enter the extension: .xsl
.
Click in the Update chars field of the xml filetype line to copy and paste this field into the corresponding field of the xsl stylesheet filetype line. Once the field is highlighted, use Ctrl-C to copy the field. Click again in the Update chars field of the xsl stylesheet filetype line and use Ctrl-V to paste the field.
For the icon field, you can either use the xml icon path used in the Icon field of the xml filetype line or better create a new icon based on the xml one by changing its colors with the Colormap Rotation filter of gimp, located under the menu.
To do it, first copy the xml icon on your Desktop, apply the filter on it, and save it under bluefish_icon_xsl.png
in a dedicated folder in your home directory, for example ~/Pictures
for Mac users.
Whichever icon you decided to use, click on the Icon field to enter its path.
Check the Editable box, if it is not already checked.
Copy and paste Content regex field of the xml filetype line into the corresponding field of the xsl stylesheet filetype line.
Set the Auto close tags mode to 1.
Click on the
button to save and close the panel.If you want to enter more than one extension in the Extensions field, you should separate them with a colon. When you define a new filetype, you should also provide new highlighting patterns. |