Skip to main content
1 of 3
Kip
  • 1k
  • 6
  • 12

Auto-completion of user name for @-replies in comments

##Screenshot / Code Snippet

enter image description here

##About

To use, type an "@" then start typing a few characters of the user's name. Then hit Ctrl+Space. The script will then search for usernames that match what you've entered so far. If there is exactly one match, it will autocomplete to "@username: ". If there is more than one match, it will autocomplete to the longest common substring of those entries matching what you've entered. For example, if you typed "@j", and both "Jeff Atwood" and "Jeff Probst" are active, it would autocomplete to "@Jeff".

The usernames that will be searched for autocompletion consist of:

  1. The person who asked this question.
  2. The person who provided this answer (if you are commenting on an answer).
  3. Anyone who has left a comment in the same comment thread you are writing your comment for.

###Multi-lingual support

Those of us without fancy foreign keyboards can type "@ol" to get Ólafur Waage, or "@a" or "@ae" to get Æther. You can also still type the foreign characters if you know how. Of course, the name has to use characters that look kind of like English characters. (Sorry, ベレアー アダム.)

###Optional configuration

There is a variable called suffix in the code. It is defaulted to ': '. This suffix will be appended after a complete match. Some people don't like the colon; if you're one of those people, just change the suffix to a space (or whatever you want it to be).

###Download

Install | View source

###Platform

Tested on Firefox 4.0 and Chrome 10.0, on Windows 7. Requires Greasemonkey on Firefox.

###License

Do whatever you want, as long as you don't sell it or claim you wrote it. If you make any cool modifications, let me know!

Kip
  • 1k
  • 6
  • 12