Thursday, March 31, 2005

Hippie Completion

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


I read in
Cendric Beaust's blog that
the latest Eclipse snapshot now has "hippie completion".
This is an editor feature where you press a keybinding
and the editor automatically completes the word you're
typing for you, by searching around in your current document
(and if not found) in other documents.



NetBeans has had this feature for at least five years.
Since Creator is built on top of NetBeans, you'll find it in
Creator too.



Hippie completion is also known as hippie expansion and originated
in Emacs. See for example
the
XEmacs documentation
.



It is bound to Ctrl-K (and on the Mac, Command-K).
Go ahead and try it - it's the best way to figure out how
it works. If the word you want to complete has many possible
matches, hit Ctrl-K repeatedly to cycle through the matches.
For example, in a typical Creator file, if you type
"Ht" and hit Ctrl-K, it's going to offer HtmlCommandButton,
HtmlOutputText, etc. if you have buttons and text components
on the page. Now aren't you glad you didn't have to
type that?



While I'm on the topic of editor shortcuts, another feature
you may not know about it "Go Back". Let's say you've jumped
around in your editor files, by clicking on error links in
the output window, or by using "Go to declaration" (alt-g if
I remember correctly), etc. You can "Go Back" just like in
a browser by hitting Alt-K. And to move forward again, hit
Alt-L. (And yes, these have toolbar buttons in Creator, and
in recent NetBeans 4.1 builds as well.)


2 comments:

  1. Hi!
    What is the name of the real action for Hippie Completion in Netbeans? (I have remapped a lot of shortcuts and I am absolutely sure I have overridden the default Ctrl + K, forgetting about it - there are almost 3 years from my last Netbeans usage).
    cheers,
    --

    ReplyDelete
  2. It's "Previous Matching Word" [word-match-prev]

    ReplyDelete