30-04-2021



A merchandise shop from Bare Bones Software, makers of BBEdit. In 2018, BBEdit celebrated the 25th anniversary of its birth as a commercial product, available exclusively for the Mac. BBEdit and Sublime Text can be primarily classified as 'Text Editor' tools. According to the StackShare community, Sublime Text has a broader approval, being mentioned in 1849 company stacks & 8508 developers stacks; compared to BBEdit, which is listed in 3 company stacks and 5 developer stacks.

BBEdit is a text editor with lots of features that make it ideal for editing any sort of code, words, or even web pages. The languages BBEdit supports natively include:

  • ActionScript
  • ANSI C
  • C++
  • CSS
  • EditorConfig
  • Fortran
  • Fortran 9x
  • Git commit note
  • Grep Replace Pattern
  • Grep Search Pattern
  • HTML
  • INI File
  • Java
  • JavaScript
  • JSON
  • JSP
  • Lasso
  • Log File
  • Lua
  • Make
  • Markdown
  • Object Pascal
  • Objective-C
  • Objective-C++
  • Perforce Specification
  • Perl
  • PHP
  • PHP in HTML
  • Python
  • Rez
  • Ruby
  • Ruby in HTML
  • SCSS
  • Setext
  • Shell worksheet
  • Software Package Notes
  • SQL (Generic)
  • SQL (MS Transact)
  • SQL (MySQL)
  • SQL (PL/SQL)
  • SQL (PostgreSQL)
  • Strings File
  • Tcl
  • TeX
  • Text File
  • Textile
  • UNIX man page
  • Unix Shell Script
  • VBScript
  • VectorScript
  • Verilog HDL
  • VHDL
  • XML
  • YAML

In addition, dozens more languages are supported in Codeless Language Modules which are enumerated both on this site and on the official Bare Bones web site.

BBEdit’s customer support is legendary. Questions can be answered in BBEdit’s Help Book or the extensive manual (both available under the BBEdit Help menu), by sending email to support@barebones.com (they answer all their emails!), and you can even get helpful pointers on Twitter at @bbedit.

Bbedit manual

Here are some of the built-in text processing actions that BBEdit can do natively (many allow grep matching):

  • Zap gremlins
  • Process duplicate lines
  • Process lines containing
  • Exchange characters
  • Change case
  • Hard wrap
  • Add line breaks
  • Remove line breaks
  • Educate quotes
  • Straighten quotes
  • Add/Remove line numbers
  • Prefix/Suffix lines
  • Sort lines
  • Increase/Decrease quote level
  • Strip quotes
  • Entab/Detab
  • Normalize line endings

It’s also fully scriptable with Applescript, and works directly with the native Perl, Python, and Ruby environments provided by Mac OS X. It also supports similar integration with shell scripts and any other Unix scripting language.

Published on 11 Nov 2013 · Filed in Tutorial · 570 words (estimated 3 minutes to read)BBEdit

In this post I’m going to show you how to make JSON (JavaScript Object Notation) output more readable using a BBEdit Text Filter. This post comes out of some recent work I’ve done in learning how to interact with various REST APIs. My initial REST API explorations have focused on the NVP/NSX API, but I plan to soon expand my explorations to include other APIs, like OpenStack.

Bbedit Format Json

<aside>You might be wondering why I’m exploring REST APIs and stuff like JSON. I believe that having a better understanding of the APIs these products use will help drive a deeper and more complete understanding of the underlying products. I could be wrongtime will tell.</aside>

BBEdit Text Filters, as you may already know, simply take the current text (or selected text) in BBEdit, do something to it, and then output the result. The “do something to it” is, of course, the magic. You can, for example—and this something that I do—use the MultiMarkdown command-line executable to transform a (Multi)Markdown document in BBEdit to HTML. All that is required is to place the script (or a link to the script) in the ~/Library/Application Support/BBEdit/Text Filters directory. The script just needs to accept input on STDIN, transform it in whatever way you want, and spit out the results on STDOUT. BBEdit does the rest.

Bbedit How To Add Picture

In this case, you’re going to use an extremely simple Bash shell script containing a single Python command to transform JSON-serialized output into a more human-readable format.

First, let’s take a look at some JSON-serialized output. Here’s a GitHub gist that shows the output from an API call to NVP/NSX to list the logical switches.

As you can see, it is human-readable, but just barely. How can we make this a bit easier for humans to read and parse? Well, it turns out that OS X (and probably most recent flavors of Linux) come with a version of Python pre-installed, and the pre-installed version of Python comes with the ability to “prettify” (make more human readable) JSON text. (In the case of OS X 10.8 “Mountain Lion”, the pre-installed version of Python is version 2.7.2.) With grateful thanks to the folks on Twitter who introduced me to this trick, the command you would use in this instance is as follows:

Very simple, right? To turn this into a BBEdit Text Filter, we need only wrap this into a very simple shell script, such as this:

Bbedit Text Editor

Place this script (or a link to this script) in the ~/Library/Application Support/BBEdit/Text Filters directory, restart BBEdit, and you should be good to go. Now you can copy and paste the output from an API call like the output above, run it through this text filter, and get output that looks like this:

(Want this as a GitHub gist?)

Bbedit 12

Given that I’m new to a lot of this stuff, I’m sure that I have probably overlooked something along the way. There might be better and/or more efficient ways of handling this, or better tools to use. If you have any suggestions on how to improve any of this—or just suggestions on how I might do better in my API explorations—feel free to speak out in the comments below.

Metadata and Navigation

Be social and share this post!

Related Posts

  • Revisiting Evernote2 Oct 2010
  • A Non-Programmer's Introduction to JSON8 Nov 2013
  • Reducing the Friction: Processing E-Mail, Part 219 Jul 2013