sponsor Vim development Vim logo Vim Book Ad

intermediate Tip #462: G's of Vim

 tip karma   Rating 40/40, Viewed by 2593 

created:   April 22, 2003 18:53      complexity:   intermediate
author:   Nitya      as of Vim:   5.7

Hi Guys !!

You can play with THE "g" in VIM editor.

Try this

Place the cursor on any variable in your program.

gd          will take you to the local declaration
gD          will take you to the global declaration.
g*           search for the word under the cursor. It's just like * but don't put < or > around words
              so here you can search word which contains word under your cursor
              Confused ???? try it NOW :-)
g#           same as g* but in backward direction

Now time for gssssss

ggdG       takes out all your hard work ;-) I mean deletes the content of the file ..

Happy viming ...

 rate this tip  Life Changing Helpful Unfulfilling 

<<Open a Perl module based on it's module name | XSLT Mappings I use to speed up developing XSLT files. >>

Additional Notes

Anonymous, April 23, 2003 11:25
g* and g# are very cool.

For source code browsing, I definitely recommend using cscope in parallel with vim. You can find more info about cscope and vim elsewhere on this site or by googling.
Anonymous, April 27, 2003 23:58
Set your 'path' variable properly, put the cursor on a filename (in a #include say) and do a
   gf
Anonymous, May 2, 2003 5:31
How is this different from using * or # on their own?
Save a keystroke  ;)
sathishvj@yahoo_stop_spam.com, May 2, 2003 18:54
If ur cursor was under the word "file", and assuming ignorecase is on then
*, #                - will find: file, File, FiLe etc.
g*, g#             - will find, apart from the above, also: FileOpen, MyFilename, file_handle etc.
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to [email protected] after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge Logo