Bluefish-The Feature Rich Editor

1
10616

This light and fast open source editor, best suited for Web development, is available across multiple platforms and supports many programming languages. The editor has also been translated to Tamil.

Bluefish is an open source editor that is highly customisable. It supports many programming, scripting and mark-up languages. The editor can be extended by adding external programs such as filters and by also adding snippets of code.  As it is an open source project, new features and language support, too, can be added. This article is based on the latest version of Bluefish 2.2.4 on Windows.

Cross-platform support
The cross-platform support is very useful if you choose to master just one editor for all your programming or mark-up needs. If your work environment is Microsoft Windows and the home PC has a Mac or Linux OS (or vice versa), then a cross-platform editor is extremely useful.

Light and fast
The binary size of the latest version of Bluefish (2.2.4) on Windows is around 4.2 MB. Over the years, it has improved both on features and performance. From version 1.0 to the latest, the editor has improved on the maximum file size it can handle and also the number of files that can be opened simultaneously.

Multiple language support for the Web programming languages, in particular
The list of programming languages that Bluefish supports is large, the most popular ones being C, C++ and Java. In mark-up languages, it supports HTML5 and ColdFusion Markup language. The scripting languages it supports are Perl, Python, Ruby, PHP, JavaScript and VBScript.

The editor is translated into 17 languages such as Russian, Japanese, Chinese and Tamil. It is best suited for Web development and deployment on Web servers.

Basic editing with Bluefish
Screen layout and panels
The editor has a menu bar, toolbar, tabs for quick access HTML mark-up, a file browser and editing area. At the bottom of the screen is the command output and status bar. The complete UI layout is customisable, with an option to hide/show panels. The menus are tearable, for accessing the most frequently-used menu items quickly. The side panel on the left gives views of the file browser, bookmarks, character maps and code snippets. Bookmarks and snippets are special features in Bluefish, which we will cover in upcoming articles.
In the side panel with the file browser view, one can perform operations on files like rename, delete, create new file, etc.

Standard project support
When working on Web projects or Java, one works with a set of files, which can be grouped as one project. You can create multiple projects of the same code base or different ones.

Word processing tools
The editor comes with a rich set of word processing capabilities, like filtering the file contents, beautifying the code (specific to the language), removing empty lines, converting files from dos2unix, removing duplicate lines, etc. Many command line utilities to process files can be added.

One interesting feature in word processing is the Synchronise Text Block feature. When multiple files are open, one can ensure a block of code is the same across the files. One of the scenarios could be that the copyright text needs to be the same across files. Another scenario could be when the footer for all Web pages needs to be exactly the same across different pages. To ensure that, you can use the Synchronise Text Block feature. The editor allows you to mark the beginning and the end of the section you need to synchronise. Note that these sections will be overwritten in all destination files.

Spell check
Bluefish comes with the spell check feature, which is useful when developing Web pages that have a lot of content. The user has the option of selecting the language and the locale at the time of editing, based on language sets chosen at the time of installation. The editor also gives the option to ‘Add to dictionary’ and ‘Ignore’ a spelling.

Code block folding
For easy code navigation, Bluefish offers a way to collapse and expand blocks of code. The blocks are automatically identified based on the programming language. To identify more types of blocks, you can modify the default settings in ‘Preferences’.  For example, in PHP, Bluefish can identify the comments block, PHP code snippets, HTML sections and JavaScript functions as separate sections.

Advanced features of Bluefish
File Browser – Open Advanced
When you need to browse a large project with multiple files, it would be painful to open one file at a time. Bluefish gives an option to open multiple files from a directory. Right click on a directory (left side panel) and select ‘Open Advanced …’ Files can be opened based on type (.css, .java, .html), a string or pattern within the file and also recursively traverse multiple sub-directories.

Bookmarking
When browsing code across multiple files or a single large file, bookmarks come handy. They let you pin a few locations of code that you would like to switch to frequently. The bookmarks are persistent across sessions of Bluefish.
Additionally, you can create bookmarks based on a pattern. This would be useful if you want to review functions that all start with a common string. In the ‘Advanced Find and Replace’ dialogue box, there is the option to bookmark all lines that match a string. The capability to match a regular expression makes it more powerful.

Figure 1Figure 2Figure 3
Find and Replace
All editors support the Find and Replace functions. Additionally, Bluefish allows restricting or expanding the scope of the search to different scenarios. If a chunk of text is selected and then the Find and Replace dialogue opened, the scope of the search is restricted to the selection.
The search can be restricted from the current point to the end of the document. To expand the scope of the search, you can search the entire document, all open documents in the editor or a complete directory. Searching the complete directory and also being able to select file-types (.h or .css) is a powerful feature. Bluefish also allows you to define the depth of directory navigation for a search.
Bluefish is one of the few editors that supports regular expressions in search and replace. This is very helpful with browser Web pages with mark-up. You can search for all the places that a particular HTML tag is used and replace the deprecated tags with a new one. For example, different programmers use different ways to specify the background-colour of HTML elements. They could use keywords like‘red’ or rgb(255,0,0) or hex code. To search all the places that hex code was used, the search string could be: background-color: #[0-9A-F]+;
The power of regular expressions is exploited when you want to convert a huge HTML table in insert records within the MySQL database using PHP code!

Syntax highlighting
Bluefish supports multiple programming, scripting and mark-up languages, which means it can identify the syntax (grammar) of each language and also give visual clues to programmers. This helps in readability and finding syntax errors. Some popular languages supported by Bluefish are listed below:

  • ASP .NET and VBS
  • C/C++
  • CSS
  • CFML
  • Clojure
  • D
  • HTML, XHTML and HTML5
  • Java and JSP
  • JavaScript and jQuery
  • MediaWiki, WordPress
  • Perl
  • PHP
  • Python
  • R
  • Ruby
  • Shell
  • Scheme
  • SQL
  • XML

Auto completion
For all the programming languages that Bluefish supports, the auto completion functionality is available. This makes coding much easier and also less error prone. After typing the first letter of the keyword, the editor gives a dropdown list of suggestions.

Dialogues and wizards
In Web development, especially, mistakes in scripting or mark-up can lead to hours of debugging. To reduce the time for debugging, Bluefish comes with a feature to write code with the help of dialogue boxes and wizards.

For example, the dialogue box is for creating an HTML table. The user needs to enter a few values like the dimensions and pick up values like colour. This wizard also gives an exhaustive list of attributes, which enables programmers to use the right attribute to achieve the desired result.

Support for remote files like FTP, SFTP, HTTP and WebDAV

This feature is seen in Linux systems. Bluefish opens remote files using FTP, SFTP and HTTP protocols, and offers the same convenience as local files. You can view and also modify remote files. This feature is useful for Web development and for publishing it online.
Snippets
In programming, we come across frequently used chunks of text. Some examples of such text in Web programming could be: opening a database connection, creating a table, opening a file and reading it. The following snippet is generated when a user chooses ‘PHP’ -> File -> Open and Print.

$fd = fopen(README, ‘r’);
while (!feof($fd)) {
$buffer = fgets($fd, 4096);
echo $buffer;
}
fclose($fd);

To maximise the benefit of a feature, you can enforce coding standards and also train newcomers by creating sets of snippets frequently used in projects. While one of the programmers creates the set of snippets and exports it into a file, other programmers can import it into the editors for coding. Creating snippets is extremely simple.

Auto recovery of files
This feature avoids loss of text or work due to system crashes. There is a temporary file that is frequently saved while editing is going on. If the system crashes before the next file-save, Bluefish recovers files from a temporary store and ensures changes are not lost.

References
[1]    Bluefish Project Home – http://bluefish.openoffice.nl/index.html
[2]    Bluefish: The Definitive Guide – http://bluefish.openoffice.nl/manual/bk01-toc.html
[3]    Create Web Pages 5 Times Faster – http://www.makeuseof.com/tag/createweb-pages-faster-bluefish-editor/
[4]    Hidden Features of Bluefish  – http://bfwiki.tellefsen.net/index.php/Hidden_features
[5]    7 Linux Web Editors Compared – http://www.techradar.com/news/internet/web/7-linux-web-editors-that-get-the-job-done-499389?artc_pg=1

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here