blingvasup.blogg.se

Bbedit 12 keyboard shortcuts
Bbedit 12 keyboard shortcuts




bbedit 12 keyboard shortcuts

There are two problems with this approach when scripting BBEdit: Set myRef to do shell script "echo " & quoted form of myText & " | wc" In this technical note, Apple recommends using the echo command to turn a command line argument into standard output, which can then be piped as standard input into another command. AppleScript has the very useful do shell script construct for running scripts like nextreflink, but it doesn’t have a good mechanism for specifying the standard input to the script. To get the next reference link number, I needed the AppleScript to call nextreflink, feeding it the text of the file being edited and collecting its output. Turning a command line argument into standard inputĪs we’ll see later, the cursor movement and text insertion necessary to insert a reference link will be handled by an AppleScript. If I decide to dump BBEdit-which is starting to look unlikely-this script, nextreflink, will still work. This is the value written to standard output.Īh, the dreaded edge case! In the original version of this script, I forgot to check to see if there were no numbered reference links. Line 11 picks out the largest of those numbers and increments it. The findall command in Line 7 returns a list of all the numbers used in reference-style links. The text to be scanned is read from standard input on Line 6. This was pretty easy to write in Python: python:ħ: reflinks = re.findall(r'^\: ', text, re.MULTILINE)ġ1: print max(int(x) for x in reflinks) + 1

bbedit 12 keyboard shortcuts bbedit 12 keyboard shortcuts

The first order of business was writing an editor-agnostic script that would scan whatever text was given to it, pick out the reference-style links, and return the appropriate number for the next reference link. His system uses Keyboard Maestro, which I don’t have, so I couldn’t just steal it.) Getting the next reference number

bbedit 12 keyboard shortcuts

(Gabe Weatherhead uses reference links, too, and he blogged about his technique for adding them back in January. I needed replacements that would work in BBEdit while I gave it a try. These commands have served me well for over six years, and I missed them greatly when I stopped using TextMate. Both took advantage of my habit of using numbers for the references instead of words or abbreviations and would automatically increment the reference number as I added more links. The second assumed the link text had already been written and was selected. The first assumed the link text was about to be written. In 2006, with the help of the nice folks on the TextMate mailing list, I made a couple of macro/command/snippet combinations for quickly inserting reference links. It is harder to make reference links, though, because you have to jump from the link text to the list of references and back. I put the references at the end of the document, sort of the way references would be placed in an academic paper. I’ve always preferred the reference style to the inline style because it looks cleaner and makes the original Markdown document easier to read directly. The URL is kept elsewhere in the document, on a line that starts with the reference and a colon. Where the link text in brackets is followed by a reference, also in brackets. Note how the URL does notĭirectly follow the link text but is put elsewhere in theĭocument, often at the end of the file or at the end of a Where the link text in brackets is immediately followed by the URL in parentheses. Markdown has two link styles: inline and reference. Next post Previous post Markdown reference links in BBEdit






Bbedit 12 keyboard shortcuts