[TxMt] Re: Inserting text into a background document
david at tm.comme.ci-comme.ca
Sun Oct 16 14:00:56 UTC 2016
On Oct. 10, 2016, at 8:46 am, Allan Odgaard <mailinglist at textmate.org> wrote:
> Can you give an example of what type of commands you’re running? Just so I better understand the workflow.
The original and main motivation is running SQL queries, but think of anything shell/command-line/REPL… basically, a non-blocking ^R. Running a SQL shell like psql in a terminal can be painful because the tabular results are usually too long to fit across the screen and get garbled by wrapping; or because there’s a lot of trial and error and “good” output is mixed with the “bad”.
Running the queries in TextMate is vastly more pleasant. Longs rows don’t matter because I can scroll horizontally, and if I don’t like the results I can simply undo the output and try again. And I can edit the output and/or use it for subsequent commands. When I’m troubleshooting a problem, I can run different queries until I track down the problem, and just keep a record of the useful steps and output. I can even save a file with the commands I ran to be used later. When I have a similar task, I can run those steps again, changing or adding or re-ordering the steps as I go.
Most of the time, the commands execute quickly. Sometimes, especially with SQL, they can take a while, and I will edit some other file while I wait. Or I’ll continue working in the same file (e.g. preparing the next steps, or maybe trying to rewrite the long query to make it perform better the next time I run it).
Of course, with that setup in place, I can run all sorts of other shell commands — it’s obviously not a complete replacement, and some things are still better done in a real terminal. But I’ve ended up using my text editor more than the terminal for everyday work. Compiling or running unit tests are other examples of longer-running processes where it’s nice to be able to monitor the output in the background.
More information about the textmate