Skip to main content

BBEdit Tips for the Hugo Static Site Generator

One of the benefits of switching to the Hugo site generator for blogging has been the ability to compose in a text editor instead of a webpage. Writing in a tool designed specifically for crafting text, with minimal distractions and focusing on the words and structure without the formatting has been a pleasing (re-)discovery for me.

Why BBEdit #

I forget when I stopped using emacs on macOS but I remember feeling frustrated that I had to spend time configuring a spellchecker separately instead of being able to use macOS’ built-in one. Having tried a variety of modern text editors and IDEs, I eventually decided that for my infrequent needs, the free version of the venerable BBEdit was a good choice. From a similar vintage to emacs, it is fast in-use, small to download, and works impeccably with modern and native macOS features; no other product I have tried ticked all those boxes.

With the release of BBEdit 15, its developers have kindly granted all users a fresh 30 day free trial of BBEdit’s full feature set. Having used the software more regularly since switching my blog platform I thought this was an ideal time to see if these could improve my blogging productivity.

Tips for the paid version #

Clippings were the first feature with which I experimented and I found the ability to parameterise the inserted text very useful as you can see from these examples:

  • I tend to write posts in multiple sessions over several days so I need to remember to update the date field in the frontmatter before I publish. This was tedious but now I can type datetime<enter> and have it insert the current date and time in the correct format using a clipping defined as: #DATETIME y-MM-dd'T'HH:mm:ssxxx#.
  • I can never quite remember the syntax for inserting a footnote so this clipping (mapped to fn) helps: [^#INSERTION#]: #INSERTION#.
  • The gallery shortcode I use for photograph posts is the same 109 characters every time but now instead of copying and pasting it from an older file, I can type one word and have it expanded.

Having a project within BBEdit brings a hierarchical view of files and folders into the left sidebar. This exists above the usual Currently Open Documents pane. I have found this a useful shortcut when hopping between different files, for example to check some advanced syntax I had used previously, or when tweaking settings which are stored in different files. While nearly the same facility could also be obtained with a well placed Finder window, the main advantage of navigating by files this way over a Finder window is that a project contains only files that have been explicitly added, meaning generated files and binaries which cannot be loaded in BBEdit can be excluded. The ordering is also manual, allowing frequently accessed files to be put close together. Each project has an extensive list of settings which look useful to web developers, but not for writing web content.

Multi-file search and replace within a project is a very powerful feature, and would be indispensable for anyone not familiar or comfortable with performing such operations in a Terminal using unix command line tools. Similarly being able to run git commands within the editor is another premium feature which I thought I might find made me more efficient. However, once the scope of the git operation exceeds a single file, it becomes easier to use the Terminal.

Tips that also work in free mode #

  • Window menu→Cheat Sheets→Markdown: markdown quick reference floating window.
  • Terminal commmand: bbedit <filename> to quickly open a file.
  • Dragging an HTML file or an image into BBEdit will generate the correct markdown (thanks to Six Colors for this tip).

For further tips and tricks for using the macOS Terminal app, please see to this blog post.

Conclusion #

BBEdit describes itself as:

the leading professional […] text editor for macOS

and I agree with this statement. Despite being simple to start using, it has powerful advanced features which would be indispensable for someone who made a living from working with text. I am a mere amateur, but it pleasing to be able to use the same tool as a professional to make my blogging more efficient.