We have already seen how to customize the quick bar, the Custom menu, and the External menu. Here are some other possibilities, most of them being made through the Edit preferences panel, accessible from the Preferences... icon in the main tool bar or from the → menu item.
Many menu entries are accessible via key combination, also called a shortcut. For example, pressing the Ctrl-S keys saves the current file to disk. If available, shortcut key combinations are shown on the right of the menu entry.
To add or change a shortcut, move the mouse over the desired menu entry, and press the key combination you would like to use. Immediately this combination will show up on the right of the menu entry.
Here's a shortcut added to the
→ menu item:To remove a shortcut, press the backspace key when you move the mouse over a menu entry to remove the shortcut.
To save the shortcut key combinations for later Bluefish sessions, use ~/.bluefish/menudump_2
.
![]() | |
If you want to restore the default combinations simply remove this file and restart Bluefish. |
![]() | |
Be aware that if you give a menu entry the same shortcut as another one, the shortcut of the latter will be lost. |
By default, invisible files and folders are not shown in the file browser tab of the side panel.
If you want to see them at a given level of the files system hierarchy, right click on the desired folder name in the file browser within the side panel and toggle Show hidden files in the contextual menu.
Here is how to view all visible files and folders in the whole system:
![]() | |
This feature is very convenient for Mac users when used with caution, since combined with the Delete contextual menu in the file browser, it allows you, for example, to get rid of files generated by cvs on conflicts within bluefish. |
By default, backup files are not shown in the file browser tab of the side panel.
You may turn on their visibility at a given level of the file system by right clicking on the desired folder name in the file browser within the side panel and toggle Show backup files in the contextual menu.
Most of the editor appearance depends on your GKT theme, which may be customized through the ~/.gtkrc-2.0
resource file.
Parts that you may want to customize through that resource file are among others:
the background color of the editor
the colors of GUI elements
the position of arrows in a drop down list
You will find examples of themes resource files while searching for a gtkrc
file in a gtk-2.0
folder within the various directories under $prefix/share/themes/
, where $prefix is your installation prefix (it may be /usr
, /usr/local
, /sw
, /opt
, etc.).
![]() | |
You should not customize those files, instead customize |
Here is an example made on a Crux theme:
style "bluefish" { # For up and down arrows grouped together at right side GtkNotebook::has_secondary_forward_stepper = 1 GtkNotebook::has_secondary_backward_stepper = 1 # Editor background color # (background of editor view) base[NORMAL]="#fcfff5" # GUI normal background color # (most of the GUI) bg[NORMAL]="#dbe9e9" # GUI highlighted background color #(GUI when mouse over elements) bg[PRELIGHT]="#c6e9e9" # GUI unactive background color #(GUI disabled elements) bg[INSENSITIVE]="#9fb2b2" # GUI active background color #(GUI enabled elements) bg[ACTIVE]="#c7d4d4" } class "GtkWidget" style "bluefish"
![]() | |
You may give any name to the style on the first line, provided that you use the same on the last line. The customization applies to any Gtk application. |
It will give this appearance to bluefish:
Other options for the Editor are available in the Editor tab of the Edit preferences panel accessible via the Edit preferences... button in the main tool bar. In particular you may want to customize the font of the editor, the end of line wrapping, and the undo history size:
When you add bookmarks to document, the name of the file it refers to is displayed from the base directory. You can choice another path from the Bookmarks filename display pop up menu in the Editor tab of the Edit preferences panel:
The HTML tab of the Edit preferences panel provides you with some options to change the style of the html tags:
One interesting feature in the HTML tab of the Edit preferences panel is that you can let bluefish update the author meta tag on save.
Let's say you created an html file with an author meta tag while you were logged in as user foo. On save bluefish will fill up the contents attribute of the author meta tag with the full name associated with the foo user:
You share this html file with another user bar or you change the owner of the file to bar. When you modify the html file while logged in as user bar, the author meta tag is updated to reflect the new author on save, providing that the user bar has write permission on the file:
![]() | |
If you do not want that the author meta tag be changed while editing the file under another user's login, uncheck the box. |
The Files tab of the Edit preferences panel allows you to set some options related to the way files are handled and displayed in the file browser.
Apart from setting the default character encoding in the Files tab of the Edit preferences panel, you may also instruct bluefish to set the encoding meta tag when you modify the document character set encoding.
Note that, if the encoding meta tag does not exist, it is inserted in the file, otherwise it is changed. Either modification occurs immediately.
You can set a default base directory in the Files tab of the Edit preferences panel.
This directory will serve as the initial point for the file browser.
By default, the file browser uses separate views for files and directories.
You can have a single view by unchecking the Use separate file and directory view option in the Files tab of the Edit preferences panel.
By default, a backup file is created on save in the same directory as the original file based on the same filename with the exception that a ~ suffix is added. This backup file is deleted on closing the file.
You can change this behaviour in the Files tab of the Edit preferences panel.
When the backup fails to be created, you can choose what to do:
A nice feature of bluefish is it allows you to open multiple instances of a file. Combined with either launching two instances of bluefish or opening the same file in two windows, it eases the modification of a file in one window while browsing it in another one.
This feature can be disabled in the Files tab of the Edit preferences panel.
![]() | |
Be aware that the last closed instance of the file wins. Hence it is important that you remember which instance is the modified one. You can, for example, always open the file to be modified on the left side of your screen, the file to be browsed on the right side. |
The User interface tab of the Edit preferences panel allows you to customize most part of the user interface:
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 5.8.1, “Customizing browsers”.
Example III.5. 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. |
The files filters allow you to group files types from the usage point of view. Once a file filter is created, you can view, hide, or open files based on a filter in the File browser contextual menu.
The file filters consist of:
a label.
whether or not the filter as defined in the Filetypes in filter hides the retrieved files or shows them.
a list of filetypes, as defined in the Filetypes part, separated by a colon.
You add, modify, delete, or move file types the same way it is described in Section 5.8.1, “Customizing browsers”.
Example III.6. Adding a file filter
Following with our example in Section 6.10, “Modifying file types”, we can add a stylesheet filter to group css and xsl stylesheets together.
To add a stylesheet filter, 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 Filefilters part at the bottom. 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 All stylesheets
.
Check the Inverse filter box.
Click in the Filetypes in filter field and enter the filetypes you want to group together, separated with a colon. Here it is stylesheet:xsl stylesheet
.
Click on the
button to save and close the panel.![]() | |
The file types used in the Filetypes in filter match those defined in the Filetypes part. Do not confuse them with the file extensions. For example the C programming file filter matches c and image filetypes, i.e. files whose extensions are .c, .h, etc... |
The highlight patterns are build from Perl compatible regular expressions. A pattern has options for coloring and styling the text it matches. Within a match other patterns can be used to color parts of that match. There are three types of patterns:
Start pattern and end pattern: that is two distinct patterns, match from the start pattern to the end pattern
Only start pattern: that is a unique pattern that matches from start to end
Subpattern from parent: that is a subpattern from the parent pattern, specified by the range in the parent pattern.
One specific pattern can also be used within several other parent patterns. The parent-match option is a regular expression that defines all parents for a certain pattern. If empty it will default to ^top$, so basically it will be on the top level.
So how does it work? Lets take a look at a little example text, a piece of PHP code within some HTML code:
<p align="center"> <?php // this is a comment ?> ?>
The first thing the highlighting engine does is finding the pattern that has the lowest match. Using the default patterns for PHP, the pattern named HTML:
has a match at position 0:
<p align="center">
So now the highlighting engine searches for the lowest match in all subpatterns of HTML, in the region matched by a type 2 pattern. Again, the lowest match will count. The pattern named <html> Tags:
has a match at position 1. This pattern is a type 3 pattern, so it matches a subpattern of the parent:
p
The match from subpattern <html> Tags ends at position 2 and it does not have any child patterns, so the highlighting engine continues at position 2 with all subpatterns from HTML. A type 2 pattern named HTML Attributes:
has the lowest match:
align="center"
This pattern does have a child pattern, again a type 3 pattern called HTML Attribute Contents:
matching:
"center"
The pattern HTML Attribute Contents does not have any child patterns, and subpatterns of HTML Attributes do not have any more matches, and also HTML subpatterns do not have any more matches. So we are back on the main level, the remaining code to highlight is:
<?php // this is a comment ?> ?>
Now a pattern named PHP Block:
has the lowest match. This is a type 1 pattern, so the highlight engine continues with all the remaining code, but it will not only search for the lowest match of the child patterns of PHP Block, but it will also ue it for the end pattern of PHP Block. The lowest match in this example is a pattern named Comment (C++/single line):
As you can see the ?> within the comment does not end the php
pattern, because it lies within a subpattern of PHP Block:
// this is a comment ?>
The pattern Comment (C++/single line) does not have any child patterns, so the remaining code for the PHP subpatterns is:
?>
It is very obvious now, the lowest match will be the end pattern of the php pattern, so we're back on the main level, and we have matched all of the code!
The config file for highlighting is a colon separated array with the following content:
mode: patternname: case_sensitive(0-on/1-off): start reg-ex: end reg-ex: start & end pattern(1), only start(2), subpattern(3): parent-match: foreground-color: background-color: don't change weight(0), non-bold(1), bold(2): don't change style(0), non-italic(1), italic(2):
The same options are found in the syntax highlighting preferences.
As an exercise you may want to add the highlighting patterns for the xsl stylesheet file type created previously. They will be based on the xml patterns with just small changes.
![]() | |
If you check the force bold weight check box, you should also check that the font you use has a bold variant in the Editor tab of the Preferences panel. |