[comp.editors] Grabbing the next word under the cursor in Vi

fozzy@mips.bhpese.oz.au (Andrew Steele) (04/22/91)

Is it possible to gain access to the same mechanism that is used by "^]" to
look up the next word under the cursor?

For those who don't know about "^]" ...
Background:
You have some program (usually C but not required) who's source is spread
over a number of files.  If you type "ctags <files>", where <files> is all
the source files for the program (if they're all in one directory it's
usually just *.c), it will produce a "tags" file. 
Operation:
You are now in one of the source files with the cursor on the start of some
function name.  If you press "^]" vi will take you to the declaration of
the function that your cursor is on, even if this is in another file.  It
does this by using the info in the tags file.

For the Experts ...
I wan't to be able to map some key so that its operation will be dependant
on the word under the cursor.  It could probably be done using a yank into
a buffer but "^]" seems to be more efficient than this.  Or, is this just a
specific hard coded optimisation within Vi.

Thanx