On 17/12/2005, at 2:03, Oliver Taylor wrote:
[...] Now, I want to collect all the words in the current document (but only within the "splay.character" scope, and use them as a list for auto-completion. So that when I tab 4 times and type "Ki" then escape, "King John" will pop up.
I know this is done with a shell command (right?) but I have no idea how to do this.
http://macromates.com/textmate/manual/working_with_text.html#completion
In your case, something like this should work (I assumed the four tabs needs to be at the begin of the line):
{ completionCommand = 'perl -pe "s/^\t{4}($TM_CURRENT_WORD.*)$|.* \n?/$1/" <"$TM_FILEPATH"'; disableDefaultCompletion = 1; }
Add that as a preferences item and set the scope for it to “splay.character”. One caveat: it extracts completions from the saved file (the completion command ought to get the entire document as stdin, but it currently doesn't).