Editing easy texts and code with Scribes

© Maxim Kazim - 123RF.com

© Maxim Kazim - 123RF.com

Toy Box

Working with the Scribes editor isn't completely automatic, but with a little skill, you can save yourself a lot of typing.

Software developers and web designers spend a lot of time working with editors. The Scribes text editor [1] provides an option that is visually neat, yet functionally surprising – in a fairly low version number. Integrating the program into your system is also easy (see the "Installation" box).

Installation

As an Ubuntu user, you install Scribes via the package manager – preferably right from the developer's sources to ensure the most current version. Open a terminal and enter the commands in Listing 1. If you prefer the Ubuntu packaged version, look in Software Center for Scribes . Installation takes a mouse click. You start the program as usual using Unity on the Dash or search for scribes using the quick starter (Alt+F2).

Listing 1

Installing Scribes

$ sudo add-apt-repository ppa:mystilleef/scribes-daily
$ sudo apt-get update
$ sudo apt-get install scribes

Opening and Creating Files

Once you start Scribes, the tool creates a new file for you. Some users might be surprised at first, because instead of menu bars and icons, you'll see a practically blank screen. The only thing you can see is the cursor and a line number on the left (Figure 1).

Figure 1: Scribes presents itself with an almost empty screen and a neat user interface.

To open an existing file, just move the cursor to the right-hand corner of the workspace, which opens a temporary icon bar. A single click of the folder icon opens a dialog of file names, or you can use Ctrl+O. Clicking the document icon (or typing Ctrl+N) opens a new file.

Easy Writer

Little details often make software convincing in an everyday way. In Scribes, these include functions such as autocompleting character pairs. If you enter a left round or square bracket, you don't need to worry about the matching right one – the editor adds it for you. With Alt+right-arrow, you move text in; with Alt+D, you delete an entire line, regardless of whether it has content.

The autocompletion function also applies to terms – no mean feat for a program of this type. Prolific writers and developers that use the same variables or expressions repeatedly can save themselves a lot of time. The program considers only expressions of more than four characters when autocompleting.

If the algorithms detect that you may want to type a previously used word while you're writing, the program shows a list of possible terms. You can then use the arrow keys to choose the appropriate one from the list and add it with Enter.

Syntax Highlighting

Whether you're writing HTML pages, Python script, or source code, these things are all considered text files. For developers to better understand the structure, many editors support so-called syntax highlighting. Thus, in an HTML page, you can more easily distinguish commands and attributes from actual content (e.g., captions and text).

Scribes can automatically detect the programming language format based on the file type. This means, when working with the editor, you should get into the habit of saving the file immediately after creating it to determine the desired format (Figure 2).

Figure 2: Thanks to color-coding, you can quickly find your way through the source code of scripts and programs.

Coding with Sparkup

These days, some preferred techniques are used to create prototypes quickly when developing software and in web design. Prototypes allow for rapid development and collection of feedback from clients. Among these techniques is Sparkup [2], which the Scribes editor supports.

Sparkup converts abbreviations to HTML or CSS statements, which is why its primary use is in web development. To use the function, save a document as an HTML or CSS file. Then, open an entry field at the lower edge of the window using Ctrl+E. This will contain the commands that the software subsequently converts. Enter the following code in the line:

div#header>h1#headline>p.test>li*3

After pressing Enter, the block code in Listing 2 appears in the main window.

Listing 2

Block Code for Sparkup

<div id="header">
  <h1 id="headline">
    <p class="test">
      <li></li>
      <li></li>
      <li></li>
    <p>
  </h1>
</div>

Help at Your Fingertips

As a program deliberately set on a simple and restrained interface, Scribes supports the use of keyboard shortcuts. The longer and more intensively you work with the software, the easier it gets. If you don't remember a shortcut, you can always call up help in the form of an overlay. The help comprehensively shows you every shortcut.

To get to the help, go to the sensitive area of the program window and when the icon bar appears, click the question mark symbol. Scribes lists all the shortcuts by topic (Figure 3), including many that make editing text easier.

Figure 3: From the icon bar or a shortcut, the editor displays a list of all the keyboard shortcuts at any time.

At the Terminal

When you're writing scripts, Scribes can extract commands right from the editor and execute them. To do so, mark the text or place the cursor in the editor window. Use Alt+X to open an entry field at the bottom, where you drag the desired command. With the list box on the right side, you can decide if you want the command results in a new window or the actual file. Pressing Enter executes the command and sends the result to the desired location.

Multiple Files

When you first start up Scribes, you likely already have an existing file to open and edit. With Ctrl+Alt+R, you open a list of the last opened files. The software also allows you to open and edit multiple files. If you're looking for documents as tabs, you won't see them. For easier navigation between files, Scribes provides several views and tools.

To quickly navigate among files in different directories, Scribes provides a sidebar for moving around the filesystem. You can activate this view with F4 and press the key again to deactivate it. If you have multiple files open, either change among them using the operating system functions or the integrated document browser that you activate with F9.

The program now shows a list of all the documents that are currently open and were previously saved. Using the arrow keys or mouse, you can change to the desired document. Changing between a saved and new document unfortunately doesn't work this way. You can change among all open editor windows with further keyboard shortcuts: Ctrl+PgUp and Ctrl+PgDn scrolls through the stack of open files.

Searching and Replacing

Searching and replacing text is one of the most often used functions. Using Ctrl+F, you can call up the bottom status bar and enter a search string. Scribes has three different search modes. The default search works as in almost all other applications: You enter text and click the button to start the search, and the application highlights all matches of the text. With Forward and Back , you move to each match.

The second search mode (Search as you type ) works like Google's instant search: Entering the first character immediately highlights each match in the text; you don't need to initiate the search. Again, the buttons navigate through the matches. You also can use regular expressions to search for character classes. If you want to replace text, use the shortcut Ctrl+R. A second replacement text field will then appear in the search bar.

Working Remotely

Often HTML pages or PHP programs require only minor changes. Scribes saves you the trouble of first downloading the document from the server to work on it. Instead, you work directly on the remote computer if need be, using Ctrl+L (Figure 4). In the resulting dialog, enter the path to and the name of the file. Be sure to indicate the protocol so that the application knows how to handle the request. Once you proceed, the software asks, if necessary, for the remote system's access codes – such as with an FTP server. If the username and password match, Scribes opens the file.

Figure 4: With Scribes, you can open a file directly on the server. However, remember to indicate the protocol so that the application knows how to handle the file.

Saving Time

Scribes developers have integrated a series of functions that help you save time. Apart from Sparkup, which is mainly of interest to web developers, you'll find an additional feature for automatically replacing text. You have the option of creating and using text building blocks. Simply enter a predefined keyword in the text. Scribes recognizes the keyword and replaces it with the corresponding building block when you press Tab.

To define the text building block, move to the trigger area at the upper right corner of the program window to open the icon bar. Click the small arrow next to the tool icon and click on Autoreplace Editor that appears in the submenu.

Click Add , and the cursor immediately appears in the abbreviation field. Be sure that the entry is long enough and contains enough special characters to distinguish it from any possible text you might enter in the body of the document (Figure 5). Next, press Enter to move to the next entry field, where you enter the expanded text that you want to appear in place of the abbreviation.

Figure 5: Thanks to integrated text building blocks, you can avoid having to type the same text over and over again.

If you use an abbreviation in the text, Scribes indicates the expanded text in the bottom bar. You make the substitution with the Tab key.

Templates

Using templates defined in Scribes, you can go one step further. You even have the option of working with variables to customize the text. You can create the basic structure of an HTML or PHP file with templates. Often the same text formulations appear over and over again in the scope of a project, and templates can help.

Scribes templates are not document templates, but material that you call up while working on a file. The program searches through the text for one of the keywords that constitutes this material. To create a template, use the Alt+F12 key combination, which opens the template editor. The application organizes the templates by programming language. Indicate the desired file format (e.g., HTML ) on the left of the window, then click the Add button to create a new building block. Scribes opens a dialog where you enter the abbreviation and description for the template (see Figure 6).

Figure 6: Using templates, you can load documents or text snippets that can contain variables.

The mask provides three fields. In Name , enter the keyword you use in the text to call up the template. Use a short but memorable term for the name, and be sure it can't be mistaken for regular text. To distinguish among various templates more quickly, enter an optional Description .

In the Template field, enter the recurring text. If you want to use placeholders in the template, enclose them in braces and avoid space characters (Listing 3). If you use a placeholder in multiple places, the software replaces it with the same content. If you like the results, just click Save and add additional templates if desired.

Listing 3

Sample Template

Hello ${greeting},
Thanks, ${person), for your e-Mail. Sorry, I only just now got to it.

To use a template, enter the keyword in the text. Scribes recognizes the keyword (provided the file format matches the one created in the template editor) and notifies you in the status bar.

To replace the keyword with the template, press Tab and the cursor immediately lands on the first placeholder for the template. Simply overwrite it by typing. Every template can contain the $(cursor) placeholder that serves to locate the cursor at the desired place in the template. Navigate among placeholders with Tab or Shift+Tab.

At the bottom of the template editor is a link with which you can load additional templates if desired. To select a template for your own work, first open the template editor. Indicate the format to use, then click the Import button, and change to the directory containing the templates. The new template then appears, and you can customize as you wish.

Advanced Settings

If you click the little arrow next to the tool icons, the program provides additional options. With the entries under Trigger Area , you can define where you want the software to display the icon bar and what colors to use to make it as unobtrusive as possible.

The additional options include a command for changing themes. If you would like a different color combination, choose Theme Selector and decide on the template. The selection dialog provides the Themes button for downloading more design templates (that you can also find on this issue's DVD). Unzip these and use the Add command to add each one to the list of active designs.

Other settings relate to various text types. You can change the font and size as you wish. You can also set how many characters to display on a line.

Conclusion

Scribes doesn't reinvent the core functions of an editor, but it can save you time and trouble by throwing some of the ballast overboard. Techniques such as Sparkup simplify your work, along with a thoughtfully designed template system. It remains to be seen what direction the project takes. If it continues using features sparingly, the still young Scribes has the potential to win a permanent place among the robust editors for everyday use.