QA Graphic
October 23, 2019

BBEdit Completion Data

A tool to easily add custom language autocorrect for coding

In BBEdit, there's a little known feature called "Completion Data." This allows developers to put in common language-specific auto-complete text, which makes writing similar code so much easier.

Basically it makes it quicker to type in common function, class or variable names.

Completion Datab
Completion Data Folder location inside of BBEdit. Also an example of Completion Data in action.

How it Works

There is a folder in BBEdit called "Completion Data" that contains text files of common text used in your code. These are organized by folders by language types. So you would only see the relevant auto-complete suggestion for the language that your currently coding.

If you never used "Completion Data" chances are this folder is empty. The collection is using the standard ctags format.

Bare Bones makes it easy to create the ctags collection, you simply use the BBEdit command-line tool.

Creating your Completion Data Collection

Here's the simple steps to create your own Completion Data collection. This example will build on JavaScript:

In Terminal, Change Directory to where you have a lot of JavaScript Files.

Run the following command:

bbedit --maketag

In your directory you'll see a new file called tags, this is the output of the above command. Go ahead and check it out in BBEdit.

Make a new folder in ~/Library/Application Support/BBEdit/Completion Data/ and call it JavaScript and move the tag file to that directory. (or just type this piece of code)

mkdir ~/Library/Application Support/BBEdit/Completion Data/JavaScript
mv tags ~/Library/Application Support/BBEdit/Completion Data/JavaScript

Now when you type something in a JavaScript file, you'll get some autocomplete suggestions based on previous code that you used.

Some Notes

You can have multiple tag files under each language, for example tags1, tags2 etc...

The language folder names have to match what you see in the bottom of the edit, such as HTML, Ruby, Markdown etc...

The "fastest" way to access the "Completion Data" folder is to use the BBEdit Menu BBEdit -> Folders -> Completion Data.

Code autocomplete is a similar concept to spelling autocomplete, basically saving typing a few characters.

"Completion Data" isn't something that your always going to do. Basically useful to have setup up every once in a while.

Permalink
October 16, 2019

HTML Paragraphs in BBEdit

Fix an issue when applying the HTML paragraph tag

In BBEdit, you can select a line and then apply the HTML Paragraph tag. It's a simple common task that HTML developers will use over and over.

The problem is, the paragraph tag gets applied to the line before and after the selected text:

<p>
Unstanch Belgrade
</p>

I would rather have the tag be applied on the same line:

<p>Unstanch Belgrade</p>

Hidden Config Settings

This can be done by changing a little known expert settings to get the above results. Copy/Paste the following in terminal:

defaults write com.barebones.bbedit HTMLParagraphMarkup_ParagraphsOnSeparateLines -bool NO??

If you find you like it how it works by default:

defaults write com.barebones.bbedit HTMLParagraphMarkup_ParagraphsOnSeparateLines -bool YES??

Now when you apply the paragraph command to any selected text it won't add the paragraph tags on the separate lines.

Permalink
October 9, 2019

BBEdit Version 13

Some cool features in BBEdit 13

Last Week Bare Bones shipped the latest version of BBEdit 13. The last major upgrade shipped on October 12, 2017.

This release has a lot of new features and bug fixes. (33 Additions!) Version 13 is not an unlucky number! Here are some of the ones that I found useful.

B B Edit13 Macintosh

Key Features with 13

There are a lot of changes in this release. Here are just some of the highlights of the changes that I noticed in this release. (Check out my review of BBEdit 12.)

Pattern Playground
Pattern Playground

Pattern Playground

Now it's easier to create the perfect regular expression statements!

Simply open up the Pattern Playground, and literally play around with regular expressions.

Once you find the perfect pattern, you can save the search pattern to be used whenever you need.

The Search Pattern isn't a "Match All" in the Content Area. It's simply a place to freely write regular expressions with some feedback. So if you are trying to apply a pattern to multiple lines, you would need to do that using the find command.

The "Use for Find" will copy your search pattern into the Find dialog box regardless if you have the dialog box open or not.

The Pattern Playground is located under the Search menu and the File->New menu.

Grep Cheat Sheet

Next to Find, File Search, Pattern Playground is a new popup menu. This is a quick in-product help with Regular Expressions. You can get some hints on how to match character strings.

Note: The BBEdit document also has some great Regular Expression tips too. (Nothing new in version 13)

Rectangular Selection

Retangular selection is when you hold down the option key and draw a rectangular selection for modification.

In previous releases, when you have text "Soft Wrap" enabled you couldn't use rectangular selection. You would have to disable the "Soft Wrap" in order to use rectangular selection.

Now if you have "soft wrap" enabled, and you use rectangular selection you'll see that the actual text gets selected and not the wrapped line.

B B Edit Find
Live Search and the Grep Cheat Sheet

Live Search now in Find Window

When you search for text using the Find command match commands now will be highlighted. In previous releases, you would use the "Live Search" to see matched items.

Apply Text Transformation

There's a new menu item in the Text group called "Apply Transform."

This allows you to quickly add a text transformation without the need to build a Text Factory file.

This is useful if you want to quickly add one of a number of text actions quickly. This is also a good introduction to the power of using BBEdit's Text Factory feature.

Clippings Pallet

The Clippings Pallet now displays hierarchically. This means when you open the Clipping Pallet, you don't see all the clippings at once. Instead, now you see the main folder groups of your clippings.

This simple change makes the Clippings Dialog to not look so overwhelming when you open it.

The other minor change is that the Keyboard Shortcut is right to align, making it easy to see which Clippings have shortcuts assigned to them.

Getting BBEdit 13

You can download a trial version of BBEdit from their website. You'll have 30 days to try out all the features.

Permalink
October 2, 2019

BBEdit Command Line Tools

BBEdit has some cool command line tools

BBEdit has some shell commands which allows integration between the MacOS Shell and BBEdit. There are four commands:

  • bbedit - Allows you to export commands to be viewed/edited in BBEdit.
  • bbdiff - Makes it easy to compare two files.
  • bbfind - Use BBEdit powerful find feature to perform multi-file searches.
  • bbresults - Easily read formated error outputs in BBEdit results window.

Here are some creative ways to make use of the BBEdit command-line tools.

Four Sample BBEdit Commands

Directory Listing

List the current directory by file size (in Bytes). The results will display in BBEdit in a new window with the Unix Shell Script settings.

ls -lahS | bbedit -m "Unix Shell Script"

Largest Files on Your Computer

Thanks to alvinalexander.com on this tip "How to find the largest size file on your computer." I modified it so it outputs to BBEdit so that it's easier to read.

du -a * | sort -r -n | head -100 | bbedit -t "Top 100 Largest Size Files"

Find Files

A simple example which: Finds all the MP3 files and open the list in BBEdit with a window title called "MP3 Files." This has an extra bit of code to suppress

find / -name "*.mp3" 2>&1 | grep -v "Permission denied" | bbedit -t "MP3 Files"

Find Content

Use the bbfind command to search through files on your computer. In this case, search for the word "Confidential" in all the files in the /Users directory.

bbfind -nw "Confidential" /Users

That last command would be fun to run to see what files are marked Confidential on your computer.

Permalink