Javascript bbedit
I wrote a script that reads the documents source language and comments out the entire current line using the correct syntax for that language.įor the keyboard shortcut I actually changed BBEdit’s default Un/Comment Selection to ⌥ + ⌘ + / so that I could configure my script with the default combination I was already used to: ⌘ + / Most of the time when I hit the “Comment” keyboard shortcut I actually wanted to comment out the entire line instead, BBEdit starts the comment wherever the cursor is located. The second feature of BBEdit that bugged me was the way commenting was implemented. Save these scripts to the directory: ~/Library/Application Support/BBEdit/Scripts Commenting Entire Line
JAVASCRIPT BBEDIT CODE
For the single quotes script I settled with the Option + Command combo because it is on the same key as the double quotes.Īll six scripts are variations of the same code shown below:ĭownload these scripts here: Wrap Text scripts So in five of the six shortcuts I simply added the command key and it felt as natural as typing the punctuation normally.
![javascript bbedit javascript bbedit](https://forums.tumult.com/uploads/db2156/original/3X/2/b/2b920e4535de2b14394aa6e00164f7acf4fef0d5.png)
It has to be easy to remember and close to the position your hand is already in when typing the punctuation key. In this situation I think the keyboard shortcut is just as important as the script itself. To alleviate this issue I wrote six AppleScripts (one for each commonly wrapped punctuation) and I assigned each one a keyboard shortcut. The first thing that drove me absolutely crazy with BBEdit is when hitting the quotes or parentheses key while text is selected, BBEdit doesn’t wrap the text in that punctuation but instead writes over the selection. Please note these articles are intended for people that are familiar enough with BBEdit to be able to add a new script and assign a keyboard shortcut in the preferences. So as I came across quirks that I could change with AppleScript, I wrote a script for them and that is what I would like to share in this mini-series of posts. It has one of the most detailed and feature-rich AppleScript dictionary I have ever seen.
![javascript bbedit javascript bbedit](https://www.wenjianbaike.com/wp-content/uploads/2021/01/bbedit_img.png)
What features BBEdit lacks, it generally makes up for in scripting ability. I don’t think one is any better than the other, I just think they solve the same problem with two different methods. The humorous part of listening to Marco describe his time with BBEdit was knowing that we shared identical opinions on all of the quirks that differentiate TextMate and BBEdit. I jumped on the opportunity to try the legendary text editor with its newly added fullscreen, auto-save, and resume features.
JAVASCRIPT BBEDIT MAC
A dedicated TextMate user who switched to BBEdit for no other reason than the lack of updates and BBEdit happened to be in the Mac App Store at a greatly reduced price. The results of his experiment were similar to many others who have attempted the same feat and after that week, according to Marco, he had returned to TextMate. I was recently listening to an episode of the popular podcast Build and Analyze where Marco Arment was discussing his experience of leaving the comfort of TextMate to test drive BBEdit for a week.