[TxMt] A few problems with inserting text via a Command ???
Allan Odgaard
allan at macromates.com
Fri Feb 11 19:36:37 UTC 2005
On Feb 11, 2005, at 12:47, Mats Persson wrote:
> 1. The inserted text is always selected, and I would prefer it to not
> be selected.
You should be able to not have it selected if you insert as snippet.
> 2. There is always a New line character behind the input, whereas I
> would just want the cursor to remain immediately behind the inserted
> text on the same line.
I know this was already answered, but just to summarize:
echo -n <your text> # insert text w/o newline
echo <your text> | tr -d '\n' # let tr delete any newline characters
Additionally you can also create your “command” as a snippet. Snippets
lets you execute shell commands using backticks (`) so e.g. this
snippet:
`date +%Y-%m-%d`
Would insert current date. For shell commands in snippets, TextMate
automatically removes the last newline. And actually, if you look in
the Text Utilities bundle, there already is a snippet to insert current
date, though with time zone set to GMT [1] and including
hours/minutes/seconds. The tab trigger is 'isoD'.
[1] after having worked with date-stamped information, I have given up
on local time-zones and their DST oddities ;)
More information about the textmate
mailing list