Using Hookmark with BBEdit

BBEdit is a professional text editor, developed by Bare Bones Software, that handles many markup languages (including HTML and Markdown), and assists with writing code in multiple languages. It is chock full of features. It is also quite useful for note-taking. Most of the documentation on this website was written in BBEdit.

BBEdit is a linkable app. Hookmark has therefore worked smoothly with BBEdit from day one of Hookmark’s existence. Hookmark enables you to link any file that BBEdit can open. It can also create and ‘hook’ new files processed by BBEdit. It can even create and hook BBEdit projects.

Copy Link, Copy Markdown Link and Hook to Copied Link

As you’d expect, Hookmark’s Copy Link and Copy Markdown Link in BBEdit return links with hook://file/ URLs. That is the URL format used by Hookmark for files that reside on Finder. You can move and rename files, whether BBEdit is processing them or not, and the links will still work.

After using Copy Link, when you paste in BBEdit, BBEdit will paste the URL rather than the name, of course.

After using Hookmark’s Copy Markdown Link, you can paste directly in BBEdit. BBEdit has a nice preview feature. You can also configure BBEdit to preview Markdown files in Marked and several other apps.

Hook to New >

On any linkable item (in any linkable app), you can invoke Hookmark and use the Hook to New command to create a new file that will open in BBEdit. Since BBEdit is a plain text editor, it can create and open files with all kinds of extensions, such as .txt, .md, .css, and .html. Just make sure that your templates folder contains a template that is set to open in BBEdit.

You can configure Hookmark so that every time you invoke Hook to New (⌘N) it creates a new .txt file that opens in Hookmark. If your Mac is already set up so that .txt files open with BBEdit, then all you have to do is make sure that your Notes preferences specify BBEdit: text.txt to open in BBEdit, like this:

Notes-preferences-tab

The Hook to New... command (with ellipses) enables you to hook to files with any extension: .md, .html, .c, etc. If you want other files to open in BBEdit, just be sure there is a corresponding custom template (one per extension). As long as macOS is configured to open the template file in BBEdit, when Hookmark creates a new instance based on the template it will open in BBEdit.

The following screenshot illustrates a number of templates that are built into Hookmark, including:

  • BBEdit: text.txt
  • BBEdit: Analytical Notes about.txt
  • BBEdit: project-.bbprojectd
  • BBEdit: text.md

Notes-preferences-tab

The text.txt template is empty. But the Analytical Notes about.txt template contains a useful template (based on Cognitive Productivity books) for taking notes.

BBEdit project file

BBEdit users will be familiar with .bbprojectd files, which are actually directories that you can think of as project files (package files). If you haven’t done so yet, you should check them out (this tutorial will help). These project files are for keeping together, and navigating between, any number of related files, which may be scattered in different folders.

It is very handy to be able to use Hookmark to link entire .bbprojectd files to other resources, such as web pages, PDFs, projects (in OmniFocus, Things, Todoist, etc.), and more.

Hook to New Folder containing a BBEdit project file (for creating: writing, composing, etc.)

In this section, we illustrate using the Hook to New > folder feature to support creating documents, screencasts, podcasts, and more, including a BBEdit project file (.bbprojectd).

The big idea is that whenever you embark on creating a new document (or media file, etc.), there are typically many ancillary documents that you need to create and use. These include an outline, an “elements” file (containing the thesis, topics, references etc.), the title, figures, feedback, etc. You may also want to keep track of previous revisions. Hookmark and BBEdit can help you create and navigate all this information very efficiently.

Start by downloading this example composition template folder. Then store it in Hookmark’s custom template folder.

This composition template folder contains the following files:

  • bbeditp.bbprojectd (A BBEdit project package file, which is actually a folder.)
  • md-.txt (This is where you write your document, in Markdown, LaTeX or whatever markup language you use.)
  • tap-.taskpaper (in case you use TaskPaper for managing tasks related to this document. You could also use BBEdit to track your tasks.)
  • elements-.txt (This is where you specify your thesis, argument, topics, references you want to use, etc.)
  • outline-.txt (You could outline your document here.)
  • spad-.txt (This is a “scratchpad file” for miscellaneous notes about your document.)
  • title-.txt (Store the title separately in this file. That way you can quickly edit it. Perhaps keep a running list of previous titles you considered for this document, so that later you can see how the project evolved. And you might decide to revert to an earlier title.)

and the following folders:

  • Communications, reviews, comments, etc. (This is for storing copies of correspondence, review feedback you received, etc. Some of these could be .hook links.)
  • Figures (Any images or figures you will use in your document. Or if they are stored separately, this folder can contain .hook files that point to the images. Or simply hook the entire folder to the images.)
  • Hook (.hook files, that point to anything else that is relevant.)
  • Previous Drafts
  • Resources and Research (Again, this could be .hook files to related papers, web pages, PDFs, etc. Or store them right here if they are “one off” resources.)

You can obviously delete and edit the template files to your heart’s content. That’s why they are stored in a “custom” folder.

Please note that the .hook files and other items can also be hooked directly to content in Yojimbo.

Hookmark has two types of Hook to New commands. Hook to New and Hook to New.... The latter (with ) requires that you choose a particular template. The template can be a file or a folder. Here we continue to focus on folders.

When you use Hook to New... from some resource and select the template folder you’ve just installed, Hookmark will:

  1. Duplicate this template folder.
  2. Name the new folder and each of its files sanely based on the source.
  3. “Hook” the folder back to the source (bidirectionally).
  4. “Hook” together all the (non-folder) files in the new folder to each other, and to the source folder.
  5. Sanely name each file.
  6. (Optionally) tag the hooked files.

So with one command, you can instantly get to work and remain in “the zone”. By hooking the new items together, you can later use Hookmark to navigate between the new items and to the source.

Although Hookmark will put all these files in the same folder, you can move them around, and Hookmark’s links will still work. For example, if you are working on a collaborative project, you would typically store the main writing file and title file in a shared folder, while keeping the ancillary files on your Mac.

Creating and using templates is extremely effective. In fact, a mark of expertise is to use finely tuned mental analogues of templates. (See papers by Gobet & Simon).

To find out more about Hook to New… folders check out:

Reveal File in Finder

Since BBEdit operates on files, you can use Hookmark to reveal in Finder any file that BBEdit is processing. BBEdit has its own Reveal File in Finder command. The advantage of using Hookmark’s Reveal File in Finder in this case is that you can use the same habitual keyboard shortcut in any linkable file-based app, including BBEdit. Just invoke Hookmark and type ⌘R to see the file in Finder. Or use Hookmark’s Title menu and choose Reveal File in Finder. You don’t need to remember whether any particular app has a Reveal File in Finder command nor what its keyboard binding is.

You can of course also use Reveal File in Finder in other sections of Hookmark’s contextual window: HOOKED, PINNED and RECENT sections.

Adding a “Hook” Finder tag to text files

By default, Hookmark adds a Finder tag to any file that it hooks. So you can search for all the BBEdit files that are hooked by searching in Finder for tag:Hook and appending the extension in question, such as tag:Hook name:.txt or tag:Hook name:.css.

Search for bookmarks in Hookmark

Since BBEdit can open all kinds of files, the most general way to find BBEdit items you’ve processed with Hookmark is simply to:

  1. Invoke Hookmark.
  2. Enter search mode (with ⌘F or a click).
  3. Type the file extensions you use BBEdit with, such as txt OR html OR css.

BBEdit’s linking functions

Two Bare Bones Software founders are original signatories of the Manifesto for Ubiquitous Linking. So it’s not surprising that BBEdit goes over and beyond the minimal requirements of the manifesto. For example, in BBEdit’s file menu there is a Copy Path menu item containing:

  • Copy Path
  • Copy Full Path
  • Copy URL
  • Copy Name

You can also control-click on any URL in a BBEdit document and choose open URL. For example if you are editing a text file containing:

[Bare Bones Software | BBEdit Product Tour](https://www.barebones.com/products/bbedit/benefitsexercise.html)

then you can control-click anywhere in the URL (https:... html), use BBEdit’s open URL command, and that page will be opened in your default web browser.

See also…

BBEdit is so full of features that it cannot be adequately summarized here! For more information: