WinEdt Macro Library  | text previous macro  | next macro



Completes words from the current file.

Suppose you had written this text:[1]

As the industrial revolution concludes in bigger and better bombs, an intellectual revolution opens with bigger and better robots. The former revolution replaced muscles by engines and was limited by the law of the conversation of energy, or of mass-energy. The new revolution threatens us, the thinkers, with technological unemployment, for it will replace brains with machines limited by the law that entropy never decreases.

Now suppose you want to type revolution again. All you need to do is to type rev and invoke this macro. It will search in the file for words beginning with rev and complete the current word to revolution.

Now suppose you type in and invoke the macro. Which of the possible completions will the macro choose? Answer: All! But of course not at the same time... First, it will complete your in to intellectual because that is the last word in the file beginning with in. Now, if you invoke the macro again (without doing anything in between!) it will continue to search and will find industrial. Invoke it another time and it will go back to intellectual since there's no other word beginning with in (except for the word in of course). The macro will search backwards, cyclic.

Now suppose you have chosen intellectual and don't want to type revolution again. No problem! Simply type a space and invoke the macro again. It will fetch the revolution and append it. This way you could copy complete paragraphs. If you didn't want an intellectual revolution you can undo the revolution (but leave the space) and invoke the macro again. It will find the next possible completion to intellectual (in this case none).


Put the macro in %b\Macros\text\.

This macro really only makes sense if you assign a shortcut to it (I use ALT- -).



Macro contributed by Robert <>.

[1] Of course you haven't since you're not Warren McCulloch and you are still alive.

WinEdt Macro Library  | text previous macro  | next macro