[TxMt Plugins] Text Buffer, Word Characters, Undo, Find, and Macro questions

Allan Odgaard throw-away-2 at macromates.com
Sat Mar 29 14:36:50 UTC 2008

On 28 Mar 2008, at 18:55, Kirt Fitzpatrick wrote:

> Several months ago I decided that I was going to hold off further  
> development of ViMate until version two of TextMate came out and a  
> documented plugin API was made available.  Since version two is  
> being compared to Duke Nukem Forever I probably shouldn't wait.

While I still want to downplay any potential release, I am using TM 2  
myself now for most stuff. So chances for a beta before summer are  
good. When a beta is out, I will gladly work a little closer with you  
to make a functional ViMate plug-in.

And anyone who writes me in N months to ask on status for the above  
can be certain to be excluded from any potential beta program :p

> Word Movement:
> [...]

There really isn’t much more than the NSTextInput protocol to work  
with here and the string/selection methods (which return the contents  
as a string).

Personally not overly optimistic about the feasibility of this for 1.x.

> Undo:
> I reworked the ViMate plugin a while back to perform complex edits  
> in a manner that would look to TextMate like one edit and therefore  
> would undo easily without any hacking on the undo manager.  Now I  
> need to hook the 'u' command to the built in Undo functionality.   
> How would I do that?

Not sure what you have done to achieve this. Calling undo: doesn’t work?

> Find:
> vi has the * command that will search and highlight all occurrences  
> of the current word in a file.  This is incredibly useful when  
> tracing through code and checking for typographical errors.  How do  
> I hook into the Find functionality programatically?  Is there a  
> built in way for me to highlight each occurrence of a word at the  
> same time without bringing up the find dialog?

You can use findNext: to find next occurrence on the find pasteboard  
(see NSPPasteboard), but highlighting multiple segments is not possible.

> Macros:
> I would like to hook 'q' up to the built in macro recording.  Again,  
> where can I find that?

There are action methods for toggling macro recording and replaying  
the scratch macro.

Probably the easiest way is to open the MainMenu.nib file and look at  
what the menus are setup to call (I can’t remember off hand).

More information about the textmate-plugins mailing list