Using Hook with BBEdit

BBEdit is a professional text editor developed by Bare Bones Software that handles many mark-up 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. Hook has therefore worked smoothly with BBEdit from day 1 of Hook’s existence. Hook 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, Hook’s Copy Link and Copy Markdown Link in BBEdit return links with hook://file/ URLs. That is the URL format used by Hook 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 Hook’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 Hook 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 Hook such that every time you invoke Hook to New (⌘N) it creates a new .txt file that opens in Hook. If your Mac is already setup such that .txt files all 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 elipses) enables you to hook to files with any extension: .md, .html, .c, whatever. 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 Hook 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 Hook, 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 Hook 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. Hook 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 Hook’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.

Hook 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, Hook 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, and
  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 Hook to navigate between the new items and to the source.

Although Hook will put all these files in the same folder, you can move them around, and Hook’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 Hook to reveal in Finder any file that BBEdit is processing. BBEdit has its own Reveal File in Finder command. The advantage of using Hook’s Reveal File in Finder in this case is that you can use the same habitual keyboard shortcut any linkable file-based app, including BBEdit. Just invoke Hook and type ⌘R to see the file in Finder. Or use Hook’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 Hook’s contextual window: HOOKED, PINNED and RECENT sections.

Adding a “Hook” Finder tag to text files.

By default, Hook 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 Hook

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

  1. invoke Hook
  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: