May 2013
1 post
Node.js / Express in BBEdit -- navigation using...
BBEdit’s Javascript (or Coffeescript) support is OK, but there are some nice things developers using Express would like.
For example, I’d like to be able to navigate my .get or .post callback blocks in the function menu.
Given how the language menu works in BBEdit this is a reasonably hard task. But an easy work around is to use Markers.
Here’s a pattern you can use with...
March 2013
1 post
1 tag
Creating Jigs with BBEdit
Yesterday I was writing this code over and over and over:
%li
= f.label :first_name, "What is your first name, good sir"
= f.text_area :first_name
The process I needed to do was:
Add a field to the database
Write those three lines of code that referenced the field I created.
I had about 40 fields to create. Half way through my task I realized I could use a Jig.
A jig in woodworking...
February 2013
2 posts
1 tag
Zooming: A feature hidden in Applescript
For a long time I’ve wanted to zoom in my documents, either to see them when really far away or to use them with a projector or Airplay.
Today I found how to do it with BBEdit, thanks to a feature in BBEdit hidden in the Applescript support.
tell application "BBEdit"
set display magnification of window 1 to 2.0 -- displays text at 2x
end tell
Woh, suddenly my text is bigger!
(set...
Finding and selecting text with Applescript
Today I needed to do a find with Applescript then select everything except the first and last character of that selection.
Even if you’re not doing this exact thing, it’s sometimes not obvious in Applescript and BBEdit how to do this task. (It took me about an hour of head scratching to get this script like it is).
To some extent I’ve already covered this topic BBEdit Hints:...
January 2013
2 posts
Example of how to create a BBEdit text filter with...
In addition to creating BBEdit text filters with Unix shell tools, you can also create them with Applescript. The User manual for BBEdit talks about this, but lacks an example.
So here’s an example, which uses Applescript to replace every space it finds with a carriage return.
Send Selection to BBEdit Worksheet
Today I wanted to send my selection to the Unix Worksheet, so I wrote a script.
The long and short of it was that I typed a Unix command in a BBEdit text window. I wanted to run this command, but I’m too lazy to copy/paste it to a Worksheet. So I wrote the following script.
tell application "BBEdit"
set output to selection as text
set uws to Unix worksheet window
tell uws
...
October 2012
2 posts
2 tags
Keep your function definitions (ctags) up to date...
I love using ctags in my BBEdit projects so I can quickly jump to the definition of a function. I’ve been manually doing this (using a feature of the Ryan’s Rails package… but today I decided I needed some automation in my life.
Enter guard a Ruby tool that watches a directory for specified files to change, and when they do guard runs a specified command.
There’s a...
1 tag
Open in BBEdit via the Shell Worksheet
While BBEdit has a great Open File by Name feature, something I like to do is use the BBEdit Worksheet to open files.
Here’s how:
Open the BBEdit worksheet. I like to use projects, so I use the project specific BBEdit Worksheet
cd into the project directory
Use the bbedit command to open the documents you require.
For example, in Rails if I want to open HTML source for a web page...
September 2012
49 posts
From @bbedit_hints on Twitter: .@MichaelZed @bbedit You can turn off whitespace...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Need to mirror files to a remote server? @mremy...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Today’s screencast I show you how to take a big...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Some interesting BBEdit themes with previews are...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Or, if you do a lot of coding, you have long...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Do a lot of writing prose or blog entries in...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: In addition to turning off menus you don’t use,...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: BBEdit includes a quick Grep Reference, in case...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Use Textile? BBEdit has basic support (language,...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Can’t remember that clipping you want, but...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: BBEdit can check the syntax for various scripting...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Use Alfred? Dave Hein has an Open In BBEdit...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Doing cross browser work? Markup -> Preview In...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: Want a list of all the placeholders for...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: @darren_bayliss BBEdit clippings have some of...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: From the BBEdit Hints Blog: Overview of...
– http://bit.ly/yhfzwc
1 tag
Overview of BBEdit's built-in FTP Browser
A comment on Twitter got me thinking about BBEdit’s FTP Browser, and now I’ve never talked about it. Today I rectify that.
While BBEdit works with many FTP programs to provide an editor for those remote files, it also comes with its own built in FTP/SFTP Browser.
I recorded a screencast on the FTP Browser - a rundown of its basic use.
If you find yourself visiting the same FTP...
From @bbedit_hints on Twitter: Use the Finder toolbar? Want an easy way to open...
– http://bit.ly/yhfzwc
From @bbedit_hints on Twitter: From the BBEdit Hints Blog: Categorized the...
– http://bit.ly/yhfzwc
1 tag
Categorized the entries on this blog
Hello!
With Twitter auto posting to this blog the long blog entries tend to get lost in the Twitter postings.
Today I fixed this - I went back and added a long tag to all the entries that are long form blog posts.
There’s a link on the sidebar on the site so you can get to these posts directly.
The bad thing is that adding the tag meant editing all my old long form blog posts, which...
1 tag
The bbedit-hints blog
I tweet at @bbedit_hints: short, daily tips on using BBEdit.
Sometimes a tip is too long for a tweet. This blog is here for those longer tips.
The BBEdit Extras Wiki is great too, it just depends on the content.
So, this blog’s mission: longer, occasional, tips on BBEdit. For when 140 characters is way too short.
1 tag
Using RVM in the BBEdit Shell worksheet
Most of my day to day work is developing Ruby on Rails applications. This community often uses a tool called RVM to separate the dependancies of multiple projects. (For example, I’m on three different projects right now, all of them using a slightly different version of Rails, and some of them using different versions of Ruby. Without RVM I would have all kind of conflicts very quickly).
...
1 tag
Pragma mark in BBEdit (for not-C languages)
One thing I like in TextMate was extending my Source language grammar to support #pragma mark statements.
I missed this feature when I moved to back BBEdit: I knew how to do it in C/C++, but I didn’t know how to do it for other languages (Python, Ruby, Javascript).
Today I was browsing the BBEdit User Manual and found how to do it:
It works like you expect in C++, but it’s...
1 tag
More useful clipping placeholders
I love writing BBEdit clippings. However, there are certain things that aren’t as helpful as they could be.
For example, jump placeholders. When I execute a snippet I always get something like:
def myf(arg1, <#options#>)
When I jump to the options placeholder, the entire placeholder is selected - including the <> symbols.
I can see why BBEdit does this - you may...
1 tag
Overriding BBEdit's language guess
Do you have files where BBEdit guesses the wrong language?
For example, I have “.note” files in BBEdit. BBEdit doesn’t know about .note files, so formats them as plain text.
However, I know they are actually Markdown documents.
The other day I ran across a way to override BBEdit’s language guess:
Use an emacs modeline:
<!-- -*- coding: utf-8; mode: markdown;...
1 tag
New Package: the BBEdit Source Package
There are certain problems you run into while coding. Problems specific to dealing with a lot of punctuation, quotation marks, style guides, etc.
Today I’m releasing the Source.bbpackage, to help you with these problems.
Based off the Source bundle in TextMate, plus additional functions I created, I hope it solves your programming related problems and makes your l333t c0d1ng skillz...
1 tag
BBEdit, the function popup, and TODO items
While BBEdit does support marking up your function popup with (#pragma) mark commands it does not seem to do the same for another staple in the programmer community: TODO notes.
While you can’t show TODO items on the function menu, you can easily turn your TODO markings into BBEdit markers, which show on the Mark menu on the toolbar (the item on the navigation bar that looks like a book...
1 tag
Language Extension Mappings (they're more than...
Today I learned that the Custom Extensions Mappings (found in Preferences -> Languages) supports more than just suffixes.
The wording of the controls make it look like just Extensions are supported: the “.rb” in “blah.rb”. But I’m dealing with files that have a prefix: “mutt-“, as in “mutt-MAC-(random characters here)”.
However, the...
1 tag
BBEdit, Email, and Mutt - tips and tricks
Introduction
In another blog entry I posted hints, tips and tricks for running Mutt on OS X. BBEdit factors prominently in this mail workflow. It’s my editor for replies and such, and piping a message into BBEdit means various useful tools are in my reach
From the BBEdit side
Install the email package
The email package for BBEdit provides a language module for email. This provides some...
1 tag
Using Emacs Local Variables to force consistant...
In Python you want to make sure that everyone on the project is always using your coding conventions (particularly with regard to tabs vs spaces). Python’s style guidelines (aka: [http://www.python.org/dev/peps/pep–0008/ PEP–8] should make this style clear, but..
Or perhaps you’re in a Ruby project, where style is still important, but more by loose, informal means.
I suggest using Emacs local...
1 tag
On LaTeX, BBEdit and the Shell Worksheet
Running LaTeX in the Unix Worksheet is “interesting” because LaTeX will prompt you to fix errors interactively. The Unix Worksheet works OK for interacting with the LaTeX’s prompts (try it!), but I usually end up typing Command-Period (thus aborting the command).
You can, however, avoid the situation:
/opt/local/bin/pdflatex --interaction=nonstopmode my_document.tex
Which...
1 tag
Applescript: open file in new window and arrange
Today on Twitter, @keichan34 asked: “@bbedit Is there some way to assign a key shortcut to View->Move to Additional Window and then the tile two front windows?”
I got interested and started writing an Applescript for Keitaroh, and I thought I’d post it here:
The hardest part was figuring out the correct syntax to grab a document and move it to another document.
Given my...
1 tag
Auto closing parans
Some text editors add ) when you type (. Natively, BBEdit does not, but you can add it by way of a clipping. Here’s how.
In a BBEdit window, type:
(#INSERTION#)
Select this text, right click, and Save Selection As Clipping.
Give it a name, and save it in set Universal Items. This will make the clipping always available, no matter what language you are using.
Now, in the Clippings...
1 tag
2 Ways to make pretty tables in BBEdit
On Twitter, @kaushikgopal inspired me by asking:
@bbedit @bbedit_hints do we have something like
Entable baked in to BBEdit? couldn’t get Entable working.
In a previous hint I talked about using the Unix Worksheet, pbpaste, and the column command to create a quick filter. pbpaste is a unix command that says, “use the contents of the clipboard here”.
In in November, I...
1 tag
Daily hints are now mirrored on...
I’m using If This Then That.com to tweet about blog entries I make here on this blog.
I’m also using that same service to send tweets I make @bbedit_hints over here, as blog entries. (They appear as “quote posts” on Tumblr).
Twitter might not be the best platform for a daily update - you could either miss my hint, or ignore it all together (if you’re not a Twitter...
1 tag
Applescript: Getting a list of open documents in...
I use BBEdit projects a lot. Sometimes when I’m scripting I want to know the contents of the “Currently Open Documents” list in my current project.
Matt Strange again came to my rescue with this Applescript snippet. Thanks, Matt!
tell app "BBEdit"
set project to project document 1
get every text document of window of project
-- returns OPEN DOCUMENTS of our...
1 tag
Applescript: inserting some text at the current...
Today I needed to insert some text into a BBEdit document via Applescript. Turns out it’s non-obivous, but here’s a snippet which does it.
tell application "BBEdit"
tell window 1
set insertionP to get selection
set text of insertionP to "Hello world! " &
(text of insertionP)
end tell
end tell
And that’s it!
1 tag
Using BBEdit with Dash.app for code lookup
An Introduction to Dash
I love how the Mac App Store has made the Mac software community feel more vibrant again, and made us aware of all the new software written by independent software vendors.
One such product is Dash, a documentation and snippet tool for developers.
Dash does two things: to organize and recall snippets (serving the same feature as BBEdit’s Clippings), and to look up...
1 tag
Applescript: Select a sentence
Today I’m going to show a BBEdit Applescript which selects a sentence.
The trick to this script is that it defines a sentence as “a blurb of text ending - and/or starting with - a period and two spaces”. However, there is some disagreement on that point.
A sentence must also start with a number or letter.
Having said that, the “two spaces after a period” gives...
1 tag
Appending (and not replacing) the clipboard's...
Ever want to do a series of Copies and have them append to, and not replace, the current clipboard?
In the past I’ve Copied my content, Pasted into the Scratchpad, gone back to my content and copied again. (Or I’ve used the “Append Selection To BBEdit Scratchpad” service).
There is a better way, built into BBEdit:
tell application "BBEdit"
extended copy selection...
1 tag
Running your selection through a one-off script
BBEdit has great support for running scripts from a file, be in Applescript or any shell scripting language. All these scripts live in the Scripts or Text Filters folder in the BBEdit preferences folder (or packaged inside BBEdit Packages).
However, you may find yourself wanting to write a one-off (ad hoc) script - just a one time use script you may never use again.
There are two ways to run a...