Hi All,
I have frequently wanted the ability to replace some text in the current document and set the selection through a command. Is this possible? I can easily replace the entire document, but setting the selection eludes me.
In addition, I'd like access to the column number along with the line number. I didn't see this as one of the exported environment variables. Allen/all, any suggestions? Thanks _matt
On Nov 3, 2005, at 2:31 PM, Matthew Gilbert wrote:
Hi All,
I have frequently wanted the ability to replace some text in the current document and set the selection through a command. Is this possible? I can easily replace the entire document, but setting the selection eludes me.
In addition, I'd like access to the column number along with the line number. I didn't see this as one of the exported environment variables. Allen/all, any suggestions? Thanks _matt
Sorry, that should read Allan.
On 03/11/2005, at 22.31, Matthew Gilbert wrote:
I have frequently wanted the ability to replace some text in the current document and set the selection through a command. Is this possible? I can easily replace the entire document, but setting the selection eludes me.
What can be done is instead use a macro. A macro can get the same command functionality (insert snippets etc.) using Text -> Filter Through Command…
That said, the need to somehow make a selection pre-executing a command is definitely useful. I'm toying a little with the thought of having commands specify what “unit” they work on, like word, line, paragraph etc. -- that's how I do for the build in stuff. But it might be more flexible just to have the command itself do the selection via a (future) scripting interface.
In addition, I'd like access to the column number along with the line number. I didn't see this as one of the exported environment variables.
It's TM_COLUMN_NUMBER
On Nov 3, 2005, at 8:28 PM, Allan Odgaard wrote:
On 03/11/2005, at 22.31, Matthew Gilbert wrote:
I have frequently wanted the ability to replace some text in the current document and set the selection through a command. Is this possible? I can easily replace the entire document, but setting the selection eludes me.
What can be done is instead use a macro. A macro can get the same command functionality (insert snippets etc.) using Text -> Filter Through Command…
Thanks, I didn't think of using a regex and a Macro and Filter Through Command. Not quite as flexible, but will work.
That said, the need to somehow make a selection pre-executing a command is definitely useful. I'm toying a little with the thought of having commands specify what “unit” they work on, like word, line, paragraph etc. -- that's how I do for the build in stuff. But it might be more flexible just to have the command itself do the selection via a (future) scripting interface.
Very much looking forward to it. I can't wait to control TextMate from inside a command.
In addition, I'd like access to the column number along with the line number. I didn't see this as one of the exported environment variables.
It's TM_COLUMN_NUMBER
I totally missed it. Sorry for the stupid question. Thanks for the help. _matt