I am working on an macro in which the selected text will be filtered through one command and then all the text after the selection will be filtered through another command. After the first command is finished, the transformed text is selected, and I need to deselect it and put the caret immediately after it. I had thought that hitting the right arrow key would do the trick, but found out [that doesn't always work][1]. Is there a foolproof way of getting the caret to land right after the selection?
And while I'm asking questions, two more:
1. Is there a way for a command to call a macro?
2. Can a macro be made to behave differently depending on whether text is selected or not?
[1]: http://lists.macromates.com/pipermail/textmate/2006-March/ 008901.html
-- Dr. Drang
On 10/3/2006, at 0:20, Dr. Drang wrote:
[...] Is there a foolproof way of getting the caret to land right after the selection?
What you can do is let the command insert as snippet. You will need to escape $, , and ` in the result, but then you have full control over where the caret should go (or what should be selected), after having the text piped through the command.
- Is there a way for a command to call a macro?
- Can a macro be made to behave differently depending on whether
text is selected or not?
Afraid the answer is no to both.
On 3/12/06, Allan Odgaard throw-away-1@macromates.com wrote:
On 10/3/2006, at 0:20, Dr. Drang wrote:
[...] Is there a foolproof way of getting the caret to land right after the selection?
What you can do is let the command insert as snippet. You will need to escape $, , and ` in the result, but then you have full control over where the caret should go (or what should be selected), after having the text piped through the command.
Cute trick. Thank you.
- Is there a way for a command to call a macro?
- Can a macro be made to behave differently depending on whether
text is selected or not?
Afraid the answer is no to both.
Thought so.
-- Dr. Drang (master of the two-word sentence)