Textastic

Posted on  by 



  • Textastic for Mac is a desktop companion to the popular iOS code editor. With support for more than 80 source code and markup languages, Textastic brings the powerful syntax coloring engine of the iOS source code editor to the Mac. This app is based on a newly developed variant of the custom code editor that powers the iOS apps.
  • Textastic, Vim, and Coda for iOS are probably your best bets out of the 6 options considered. 'Very fast' is the primary reason people pick Textastic over the competition. This page is powered by a knowledgeable community that helps you make an informed decision.
  1. Textastic App
  2. Textastic Python
TexastickidsTextastic code completion syntax

Textastic is a programmers editor for iOS. It’s not perfect, but it’s very close to the app that I was waiting for ever since the first iPad was released.

TextasticGithub

Most of them are Textastic-specific, but the Open In option hands the text off to the standard iPad share sheet. From here, I tap Shortcuts, then Run As Shell Script, and voila! Shortcuts opens an SSH connection to my Mac, runs the three commands in build.sh, and returns to Textastic. On my Mac is a newly built PDF of the report.

Even before I had an iPad, I’d mostly stopped using my laptop. The only time I did use it was when travelling overnight (I’d take it if I had to work while away, or in case there was an emergency and I had to work on something). I don’t need a full computer for this – typing on a software keyboard on a 9.7 inch screen is perfectly adequate for emergency work, and when combined with a bluetooth keyboard (which is small enough to easily pack, and I already own) and a monitor (now a TV via AirPort mirroring) it’s quite useable as a work-while-travelling device.

The only missing component was the software: for a very long time there was nothing available. There are oodles of word processing applications, note takes, and there are even a few HTML editors – but nothing designed for real programming work. I’m not sure why this is, but I suspect that most professional programmers already have something along the lines of a small MacBook Pro or Air and find it convenient to travel with that, so wouldn’t use an iPad, even in these situations. The best available was, unfortunately, using SSH (this was before Prompt, too) and doing the word in a command line on a server somewhere.

At $14, Textastic is expensive for an iOS app, but cheap for a programmers tool (it’s definitely worth the price). This is a text editor, not an IDE, so you don’t get a debugger or interactive prompt or anything like that – it would be difficult to do that anyway given Apple’s restrictions, and I prefer a dedicated programmers text editor to an IDE anyway. (You can easily switch to other apps that together provide most of what an IDE does).

It’s a good editor – it does syntax highlighting for many languages (including Python and everything else I’m interested in), shows line numbers, and you can switch the file’s encoding and line ending choice. You can quickly jump to “symbols” (e.g. method), although I generally just scroll since I know where I’m going. There’s a decent find (and replace), and you can choose from DejaVu Sans Mono, Courier New, Luxi Mono, Monofur or Inconsolata for the font. There are a variety of colour themes, there’s control over tab settings (including soft tabs) and word-wrap. Although you can set the font size, you can also just pinch & zoom to get the size that you’re after, which is far superior to manually picking a size.

Generally the app does what it should: it gets out of the way and lets you get on with writing/editing the code. There’s an additional top row in the keyboard that offers symbols that you’re likely to need (this oddly scrolls horizontally to fit everything in) so that you don’t have to toggle between keyboards often (except for numbers) if you’re not using an external keyboard.

Where the app falls down for me is where iOS in general performs badly: moving data between applications. You can share files to the app (e.g. from Dropbox), and there are actually many ways of getting files in and out (via WebDAV, iTunes, creating local files), but you’re left with the same issue that lots of iOS apps have: you end up with duplicates. To its credit, the app tries to address this (e.g. it can know that a file you’re editing belongs in a particular Dropbox location and sync the changes back), but at the end of the day it’s clearly a hack. The app is still useable, but this does mean that I more often read code in it than write it (it’s far better for reading code than the Dropbox app is).

Textastic App

It seems obvious to me how to fix this problem (I don’t understand why it isn’t already the case). Surely nearly every programmer that would use this app has their code stored in some sort of repository (CVS, SVN, Git, Mercurial, Bazaar, etc). The repository is the file system. The app has a working copy checked out, and you can commit changes back to the repository. The app doesn’t need to support every action that the VCS/DVCS offers – really just (in SVN terms) add/remove/update/checkout (and perhaps propset) – if you need to do something else, then you use a dedicated SVN/Git/etc app). This completely solves the issue of multiple copies of files, because that’s exactly what these tools are designed to handle.

Unfortunately, the app would need to support at least SVN, Git, Mercurial, and Bazaar since there’s a lot of diversity at the moment. However, it seems likely that there are libraries that can be used (even in iOS) that would handle a lot of the grunt work. If the app let me check out a SVN working copy, make changes, and then commit them back, it would be absolutely perfect (I’d pay ten times the price if the app supported this).

If you need a programmers text editor on iOS, then I highly recommend Textastic.

June 3, 2019 at 9:47 PM by Dr. Drang

When your audience is mostly Apple users, the evening after a WWDC keynote address is probably not the best time to post anything that isn’t about the day’s announcements. But I have one more thing to say about writing in LaTeX on the iPad.

A couple of days ago, I described a Drafts action and Shortcut that allow me to compile my LaTeX files on my Mac from my iPad. This is great if I’m writing in Drafts, but what if I’m using another editor? Specifically, what if I’m using Textastic, which has good integration with Dropbox and LaTeX syntax highlighting? If my report has complex formatting, that highlighting makes it nicer to write LaTeX in Textastic than in Drafts.1

Textastic Python

Unfortunately, Textastic isn’t scriptable, so I can’t write an action for it the way I could with Drafts. But it does have a way of passing text to a Shortcut, so with a little trickery I can get around its limitations.

Here’s a file in Textastic with the commands needed to compile the LaTeX file over an SSH connection:

These are the same commands I used in the PDFLaTeX shortcut from Saturday’s post:

The only difference is that the directory (~/Dropbox/projects/test/report) and file name (report.tex, but latexmk doesn’t need the extension) are given explicitly instead of as dictionary look-ups. As you can see, they’re saved in a file named build.sh, but the name doesn’t really matter. And although the commands will be run on a Macintosh, where report.tex is saved, build.sh doesn’t have to be saved there, certainly not in the same folder as the report. It can be a local file on your iPad or saved in the Textastic folder of iCloud. What’s important is that you can put it in a tab in Textastic, because we’re going to send its contents to a Shortcut.

And here’s the Shortcut:

All it does is log on to my Mac and run the commands that are passed into it as text. That text comes from build.sh.

When I’m writing in Textastic, I keep the LaTeX source for the report in one tab and build.sh in another. To compile my LaTeX file, I tab over to build.sh and tap on the Sharing button in the top right corner. This brings down a menu with options for processing the text in the active file.

Most of them are Textastic-specific, but the Open In… option hands the text off to the standard iPad share sheet.

From here, I tap Shortcuts, then Run As Shell Script, and voila!. Shortcuts opens an SSH connection to my Mac, runs the three commands in build.sh, and returns to Textastic. On my Mac is a newly built PDF of the report.

This is not nearly as convenient as pressing ⇧⌘P in Drafts—in fact, it requires five taps to compile and another to get back to the report file. But it is a way to write in Textastic without having to keep a Prompt connection to my Mac as an active app in Split Screen.

  1. I’m hoping Greg Pierce adds a syntax highlighting engine to Drafts that understands LaTeX (and Python and Bash and …). I think it’s on his Someday list, but I don’t know how many other things are ahead of it. ↩





Coments are closed