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

Kirt Fitzpatrick kirt.fitzpatrick at gmail.com
Fri Mar 28 17:55:55 UTC 2008

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.  I apologize  
if any of these are noob Cocoa questions.  I use vi on OS X, I'm  
either a die-hard or a Cocoa-noob.  Probably both.  ;-)

Word Movement:
I believe that I need to get access to the text buffer and some list  
of word and non-word characters so that I can move by word properly.   
Right now I am using the moveWordForward,  
moveWordBackwardAndModifySelection... methods to accomplish this but  
they are inadequate especially near boundaries such as the end of line  
or end of file.  Moving by word will switch from jumping to the  
beginning of words to jumping to the end of words and back.  It's a  
crap-shoot and is the cause of most of the bugs in the ViMate plugin.   
Is there a way for me to get access to a list of known word/non-word  
characters known by TextMate as well as the text buffer and current  
position so I can implement my own movement and selection commands?

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?

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?

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


More information about the textmate-plugins mailing list