QA Graphic
November 7, 2024

A Guide to Customizing BBEdit 15 Cheat Sheets for Quick Code Insertion

My tips on how to create, organize, and optimize Cheat Sheets

Cheat Sheet B B Edit

BBEdit 15, the go-to editor for Mac users, is packed with new features to boost productivity. Among them is the Cheat Sheet tool - a handy, customizable reference that makes recalling common code snippets a breeze. Think of it as your own digital "training wheels," offering quick, one-click access to those elusive pieces of syntax or code structures you find yourself frequently looking up.

Here's a breakdown of what the Cheat Sheet tool has to offer, along with five tips I've learned along the way to help you get the most out of this powerful feature.

Getting Started with Cheat Sheets

Cheat Sheets are accessible from the Window > Cheat Sheets submenu. This brings up a floating window that acts as a mini-reference guide within BBEdit. On the left-hand side, you'll see the code snippet (or "cheat"), and on the right, a brief description.

To use a cheat sheet, simply double-click the snippet you want to insert. The code will automatically be added to your active document. Alternatively, you can drag snippets directly into your code wherever needed - perfect for quickly filling out repetitive code blocks in any programming language.

The built-in cheats include examples for Markdown and Clippings placeholders, but you can tailor your own cheat sheets to fit your coding style and language needs.

Five Tips to Master the Cheat Sheet Tool

Here are a few things I've learned to streamline the use of Cheat Sheets:

  • Customize Your Cheat Sheet in iCloud Drive
    Cheat Sheets are stored in iCloud Drive > BBEdit > Application Support > Cheat Sheets. Open up this folder to find the JSON files where you can add your own custom snippets. Keeping your snippets in iCloud ensures they're accessible across your devices.

  • Keep Your JSON Format Correct
    If you've added a cheat sheet but it's not appearing under Window > Cheat Sheets, it's likely due to incorrect JSON formatting. Each snippet requires headers and must follow proper JSON structure. Take the time to verify the format to avoid issues.

  • Refresh the Cheat Sheet Dialog
    Whenever you make changes to the JSON file, close and reopen the Cheat Sheet dialog. This reloads the file so your latest updates will be reflected in BBEdit - no need to restart the program.

  • Add Line Breaks for Multi-Line Snippets
    If your cheat requires multiple lines, use \n to indicate where to add line breaks. This trick lets you structure more complex code snippets without cramming everything onto one line, making it easier to insert structured blocks of code.

  • Insert Spaces Between Cheats
    To separate sections or group related snippets, you can use empty text and description fields to create a blank row. However, avoid leaving either field populated alone, as BBEdit may crash if you only have text or only a description filled out.

Sample Sheet Sheet Code

Python Cheat Sample
Sample code from my Python Cheat Sheet file.

Building Your Custom Coding Library

With Cheat Sheets, BBEdit 15 lets you create a personalized, easily accessible library of code snippets. Customize them for HTML, JavaScript, CSS, Python, or any language you're working with. By offloading these snippets into a Cheat Sheet, you can focus more on your actual coding and less on remembering every detail of syntax.

So if you're ready to save time and avoid unnecessary searches, take advantage of the Cheat Sheet tool in BBEdit 15. It's a straightforward yet powerful way to streamline your workflow and make your coding experience even more productive.

Permalink
April 24, 2024

Pattern Playground

Cool Tool to figure out the right formula

Regular expressions (regex) are a powerful tool for text processing, allowing you to search, replace, and manipulate text with precision and efficiency. However, crafting the perfect regex pattern can be a daunting task, often involving a lot of trial and error. Enter BBEdit's Pattern Playground: a feature that transforms the art of regex into a more manageable and interactive experience.

Pattern Playground
Using Pattern Playground to figure out the best way to get the Domain Name from a URL.

What is BBEdit's Pattern Playground?

BBEdit, the leading professional HTML and text editor for macOS, has long been celebrated for its robust text manipulation capabilities. With the introduction of the Pattern Playground?[1], BBEdit takes regex handling to a new level. This interactive interface lets you experiment with Grep patterns (BBEdit's term for regex) in real-time, providing immediate feedback on what will match and how.

Why is it a Game-Changer?

The Pattern Playground addresses one of the most significant challenges in regex: the complexity of creating patterns. It reduces the guesswork and streamlines the process by showing you exactly what your pattern matches as you type. This live feedback loop is invaluable for both beginners learning the ropes and experts refining complex patterns.

Interactive Interface

At the heart of the Pattern Playground is an interactive window where you can input your regex patterns. As you type, the pattern is checked live, and any matches are highlighted in the "Contents of" section, which displays the text of all open documents.

Grep Cheat Sheet

For those who need a little help, the Pattern Playground comes with a Grep Cheat Sheet. This handy reference provides quick access to common regex idioms, helping you build patterns faster.

Capture Groups and Substitutions

BBEdit's Pattern Playground goes beyond simple search patterns. It allows you to define capture groups and experiment with substitutions. The interface shows you all the defined capture groups and updates the "Replacement Text" field in real-time as you edit the "Replace Pattern" field?[1].

How Does it Benefit You?

Whether you're a developer, writer, or data analyst, the Pattern Playground can significantly enhance your productivity. Here's how:

  • Efficiency: Quickly find and replace text across multiple files with precision.
  • Accuracy: Reduce errors in pattern creation with live validation and feedback.
  • Learning Tool: Improve your regex skills through an interactive and forgiving environment.

Conclusion

BBEdit's Pattern Playground is more than just a feature; it's a testament to Bare Bones Software's commitment to making text manipulation accessible and efficient. By demystifying regex and providing a user-friendly platform for experimentation, BBEdit empowers you to harness the full potential of text processing with confidence and ease.

So, if you're looking to find the right regular expression formula without the headache, give BBEdit's Pattern Playground a try. It might just become your go-to tool for all things regex.

Permalink
April 17, 2024

BBEdit Notebooks

Great Feature to Stay Productive

BBEdit Notebook is a great way to keep your text notes organized. Now users don't have to have lots of text files cluttering their hard drives.

Five Things That Make BBEdit Notebooks Useful

B B Edit Search Notebook

Search Notebooks

Notebook search lets you find what you need instantly. This eliminates the need to sift through clutter in a broader search, saving you valuable time and frustration.

Real World Example:

I use search to find code tidbits such as Date/Time format in Javascript or opening a database in Python. Search is quick and easy in BBEdit - even faster when your targeting the search in the notebook where you stored the data.

Create Multiple Notebooks

Create dedicated notebooks for work projects, career development plans, and personal hobbies. This organizational approach keeps your thoughts on each topic focused and helps you avoid context switching. By compartmentalizing your life with BBEdit notebooks, you can achieve a healthy work-life balance and ensure you're giving each area the attention it deserves.

Real World Example:

I use separate notebooks for website development, work projects, and personal life. This keeps my notes well-structured and accessible. To refresh my approach in January, I created new notebooks for a clean slate. Of course, I can still search the old notebooks whenever needed.

Execute Code in Notes

BBEdit notebooks aren't just for jotting down ideas. You can write actual code in them, and then hit a button to run it! This means no more switching back and forth between your code editor and your notes. Need to use that same code snippet all the time? Just keep it in your notebook and fire it up whenever you need it. It's like having a personal code cheat sheet built right into your notes. Makes those repetitive tasks a breeze.

Real World Example:

I have some Python Automation code that does some quick check on websites that I am testing.

B B Edit Execute Code
Execute Code Example

Notebook Collections

Imagine your notes panel as a bustling workspace. BBEdit Notebook Collections act like filing cabinets, letting you group related notes together. This goes beyond simple organization ? it streamlines your workflow. No more wading through a sea of notes! With collections, you can categorize notes by project, topic, or any other criteria that works for you. This makes finding the information you need a snap, saving you valuable time and frustration. Plus, a clean and organized Notes panel fosters better focus and keeps you in the zone. So ditch the clutter and embrace the power of BBEdit Notebook Collections ? they're the key to a more efficient and productive note-taking experience.

Real World Example:

My Blog notebook thrives on dynamic organization. I add content for future posts as inspiration strikes. For instance, after a delicious gluten-free meal at a new restaurant, I'll jot down a quick note in my "Gluten-Free Collection" to ensure I don't miss blogging about it. This approach keeps my content calendar flexible and ensures I capture every blog-worthy idea.

Notes Names with Emojis

Infuse your notebook titles with personality and purpose using emojis. These little visual icons act as powerful flags, helping you instantly recognize the right notebook at a glance. No more scrolling through endless lists of generic titles. With emojis in the mix, scanning your notebooks becomes a breeze, saving you valuable time and frustration. So go ahead, get creative and add a touch of emoji flair to your note-taking system!

Real World Example:

In my notebooks, any executable notes has a gear emoji. This helps that note to stand out from other notes. Also when I post a blog, I put a green checkmark in the name so that I know that post was posted.

Permalink
April 10, 2024

BBEdit Search Box

Best Tool for Search and Release

For efficient text manipulation, BBEdit shines. Its search and replace capabilities are top-notch, offering a user-friendly interface that surpasses what I've encountered in other IDEs. This streamlined approach saves me significant time when working with large codebases.

BBEdit Search Box

Five Things I Learned

  1. BBEdit Search History: BBEdit maintains a history of the last 30 searches, allowing for easy reuse and saving time on repetitive typing.

  2. Save Searches: You can save searches for later use, which is beneficial for frequently performed search/replacements and complex search patterns. Bare Bones provides sample patterns for reference.

  3. In-Dialog Grep References: The in-dialog Grep references for both search and replace functions simplify the process of finding the correct grep combinations. BBEdit also highlights the search results for clear visibility.

  4. Shortcuts for Search/Replace: Utilize shortcuts like "Use Selection for Find" (Command E) and "Use Selection for Replace" (Option Command E) to expedite the search/replace process by pre-populating the fields before opening the dialog.

  5. Extract Match Text: BBEdit can extract matched text into a new document by finding all instances of the search string in the current document or search set and compiling them into a new untitled text document, separated by line breaks.

Permalink
April 3, 2024

Text Handling Features

Cool ways to Control Your Text using BBEdit

Whether you're a seasoned developer, a writer, or a web enthusiast, BBEdit's robust text handling capabilities make it an indispensable tool for manipulating text with ease.

BBEdit's Text Handling Features

BBEdit offers a plethora of features that streamline text editing and enhance productivity. Beyond the standard text entry and editing functions, BBEdit boasts several built-in tools for text manipulations. Let's explore some of these features:

  1. Exchange Characters & Words: Swap characters or entire words effortlessly.
  2. Change Case: Quickly convert text to uppercase, lowercase, or title case.
  3. Shift Left/Shift Right: Indent or unindent lines with precision.
  4. Un/Comment Selection: Comment or uncomment selected lines for code readability.
  5. Hard Wrap: Wrap lines at a specified column width.
  6. Add & Remove Line Breaks: Manage line breaks seamlessly.
  7. Apply Text Factory: Perform a series of text transformations on multiple files simultaneously.
  8. Educate Quotes: Convert straight quotes to curly (smart) quotes.
  9. Straighten Quotes: The feature you're interested in! Straighten curly quotes back to their straight form.
  10. Add/Remove Line Numbers: Enhance code navigation by adding or removing line numbers.
  11. Prefix/Suffix Lines: Append or prepend text to lines.
  12. Sort Lines: Alphabetically sort lines for better organization.
  13. Process Duplicate Lines: Handle duplicate lines efficiently.
  14. Process Lines Containing: Use grep patterns to manipulate specific lines.
  15. Canonize: Perform powerful batch changes across files.
  16. Rewrap Quoted Text: Perfect for reformatting or preparing email and online content.
  17. Increase and Decrease Quote Level: Adjust quote levels as needed.
  18. Strip Quotes: Remove quotation marks from text.
  19. Entab/Detab: Convert tabs to spaces or vice versa.
  20. Normalize Line Endings: Ensure consistent line endings across platforms.

Scriptability and Integration

BBEdit is not just a standalone editor; it's also fully scriptable. You can harness the power of AppleScript to automate tasks and create custom workflows. Additionally, BBEdit seamlessly integrates with the native Perl, Python, and Ruby environments provided by macOS. If you're a shell scripting aficionado, you'll appreciate its compatibility with Unix scripting languages.

Conclusion

BBEdit's commitment to text handling excellence sets it apart. Whether you're tidying up code, writing prose, or crafting HTML, BBEdit's arsenal of features empowers you to work efficiently. So next time you encounter those pesky smart quotes, remember that BBEdit has your back!

Give BBEdit a try and experience the joy of text manipulation: Download BBEdit today!

Permalink
March 27, 2024

BBEdit's Select Column Feature

Some creative ways this can be handy

BBEdit, the leading professional HTML and text editor for macOS, boasts a multitude of features designed to enhance productivity and efficiency. Among these is the Select Column feature, a powerful tool that allows users to select and edit columns of text, which is particularly useful in data manipulation and code editing.

What is the Select Column Feature?

The Select Column feature enables users to create a rectangular selection in their text document, spanning across multiple lines. This is especially handy when dealing with tabular data or when you need to edit multiple lines of code at once.

How Does it Work?

To use the Select Column feature in BBEdit, you simply click and drag your mouse pointer while holding down the Option key on your keyboard. This creates a rectangular text selection. You can then type, delete, or drag text to manipulate the selected columns.

Practical Examples

Example 1: Data Alignment

Imagine you have a list of items with their prices, but the prices are not aligned, making the list difficult to read. With the Select Column feature, you can quickly select the column where the prices are and add spaces or tabs to align them perfectly.

Item          Price
Bananas       $1.00
Apples        $1.50
Oranges       $2.00

Example 2: Code Refactoring

When refactoring code, you might need to add a specific piece of code to multiple lines. For instance, if you're adding a logging function to several lines of a script, you can select the column where you want to insert the function and type it once, applying it to all selected lines.

console.log('Function A start');
functionA();
console.log('Function A end');

console.log('Function B start');
functionB();
console.log('Function B end');

In conclusion, BBEdit's Select Column feature is a testament to the editor's commitment to efficiency and precision. Whether you're a programmer, a data analyst, or someone who appreciates the value of streamlined text editing, this feature is sure to become an indispensable part of your toolkit.

Permalink
December 25, 2019

Release Note Easter Eggs

Couple of small references to Christmas in the release note.

BBedit Release Notes are always filled with hidden humor. On this Christmas Day, I thought I highlight a couple of Christmas references.

BBEdit 9.6.2 Release Notes

OMG did you see the Christmas episode of "Glee"? Was that awesome, or what?

BBEdit 10.1.1 Release Notes

Fixed a bug in which typing at the end of a line would fail to scroll the insertion point into view as it should have. Merry Christmas, Jim.

Have A Merry Christmas!

I hope everyone had a great Christmas and Santa brought everything on their shopping

Permalink
December 18, 2019

Text Status Bar items

General information on the text status bar that you see in BBEdit.

At the bottom of every BBEdit Window is a Status Bar. This bar contains some quick information about the current document.

BBEdit refers this as the Text Status Bar items

BBEdit Text Status Bar Items

These are the items that are available in the Text Status Bar. They are all enabled by default. This is the order that they appear in the bottom of the window, from left to right.

You can remove any item in the Text Status Bar by going under Preferences, then Appearance then unchecking the items under the "Text Status Bar items."

Cursor Position - The current location of the Cursor. It shows the line and character position. When you click on the Cursor Position numbers you can enter in a line number to "jump to." This is useful when navigating a large file, or when you're debugging a code issue on a particular line.

Language - This shows the current selected language. Clicking on the Language allows you to change the language type. BBedit uses this to determine how to map out the colors in the document.

Text Encoding - This is the document encoding. This is used to determine how to handle special characters. Click on the current encoding to change it. For most documents, the Unicode (UTF-8) should be fine.

Line Break Type - This is the line break format used in the current document. Most Macintosh users should stick with the Unix (LF) but if you get a document from Window users you will see it's in Windows (CRLF).

Document Lock State - This tells you if the current document is locked or not. You would lock a document if you don't want any changes being made. In addition, you may encounter lock documents because your user doesn't have write permissions on that file.

Document Save Date - Just the last saved date of the document. The only want to change this is to... well save the document. Sorry Marty McFly, you can't change the past in BBEdit.

Document Statistics - This is where you find out how many characters, Words, and Lines are being used in this particular document. Very useful when opening up a large document and wanting to know the size. Clicking on the numbers opens up a pop-up dialog box where you see the numbers with the title text and some additional information about that document such as Write Permissions and the location. When you select text the Document Statistics will display information about the active selection.

Magnification - This shows the text current magnification level. Click on the number that allows you to change the document magnification level. This is the only place to change the magnification level. In the Preferences, you can change the default magnification from 100% to any amount you want.

Assign Short Cuts

You can assign short cuts to many of the Text Status Bar items. Simply open up Preferences, then Menus & Shortcuts, then select the "Status Bar."

You'll see that Open Language Menu (Control Option L) and Open Text Encoding Menu (Control Option E) already have short cuts assigned to them.

If these are items that you don't think you'll use too much, remove the short cut and assign it to something that you may use more.

Permalink
December 11, 2019

Navigation Bar

Some tips and tricks around BBEdit's Navigation Bar

On top of the editing window is a small navigation bar. I usually ignore it. However, I thought I look into the features of the Navigation Bar and see if there's anything that might be useful for my use.

BBEdit Description

The navigation bar is a panel at the top of a text window that provides controls for selecting the active document and for moving to specific points with the current document. To hide the navigation bar, choose Hide Navigation Bar in the View menu, or turn off the Navigation Bar options in the Appearance preference panel.

Five Things I Learned about the Navigation Bar

You can simplify the items that appear in the Navigation Bar in the Preferences Panel -> Appearance. (For example, if you're not using the Functions pulldown menu, you can disable that.) Everything is enabled by default.

The Text Options icon, the gear icon, is a quick way to get access to common text settings. Items that are selected here only apply to the exiting editing window. If you want to make a change that impacts all open windows, use the Text Display menu (View -> Text Display)

The Counterparts option (square icon) is an easy way to navigate related files. One neat thing is that it will show similar text files in a directory. Simply click on the icon and you'll see files in the directory that the file is saved in.

The Markers functionality is a good way to manage a large document. If you're debugging a log file, you can set a Marker, continue scrolling, and easily get back to the placeholder. In 13.0, you can open up the Markers window (Go -> Markers) and see all the available markers in your current active document.

As of BBEdit 13.0.3, there are no "extra" advance features available for the Navigation Bar.

Permalink
December 4, 2019

Lorem Ipsum in BBEdit

Cool tip on using Lorem Ipsum in BBEdit

BBEdit has built-in Lorem Ipsum placeholder text. This is useful when you want to text but don't have the official version from Marketing.

Lorem Ipsum is located under the Edit Menu -> Insert -> Lorem Ipsum

B B Edit Insert Menu

Three Styles

You have three styles for your Lorem Ipsum content:

  • Normal - Typical Lorem Ipsum used since the 1960s.
  • Bacon - From the Baconipsum website: "Simply put, it???s a take on the lorem ipsum filler text used when doing design mockups. I was mocking up a web design one day and needed a few words to fill out a link. ???Lorem ipsum bacon??? popped into my head, so I plugged that into my HTML. Later that day, it hit me. Make a lorem ipsum generator but use types and cuts of meat."
  • Startup - From the Startupsum website: "Less boring. Slightly more relevant. A perfect blend of being professional and having fresh filter content."

Three Types

  • Words - Perfect when you want a filler word for a list item.
  • Sentences - Need a sentence for an image caption?
  • Paragraphs = Great when your trying to make it look like you wrote a lot of text. Using the "Start up" on the company about page is a neat trick.

B B Edit Preferences

Cool Tip!

You can add a short-cut to Lorem Ipsum. In fact, when you go to the Menu & Shortcuts section of Preferences, you'll see a second "Lorem Ipsum" without the "..." This repeats the last Lorem Ipsum action. I would recommend adding a Keyboard Shortcut such as Command Shift L.

Permalink

About

Welcome to the BBEdit Blog, the official source of insights, tips, tricks, and inspiration for all users of BBEdit, the powerful text and code editor from Bare Bones Software. Whether you're a seasoned developer, a budding coder, or someone who just loves the precision of text editing, this blog is crafted for you.

Interested in getting BBEdit? Get it from Bare Bones' Website.

Check out all the blog posts.

Blog Schedule

ThursdayBBEdit
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
MondayMedia Monday
TuesdayQA
WednesdayAffinity