Wikia

Vim Tips Wiki

Changes: Go to definition using g

Edit

Back to page

(Undo revision 32584 by 82.234.142.173 (talk) useful, but has nothing to do with the content of this tip)
(Change <tt> to <code>, perhaps also minor tweak.)
 
Line 15: Line 15:
 
}}
 
}}
 
Place the cursor on any variable in your program.
 
Place the cursor on any variable in your program.
*<tt>gd</tt> will take you to the local declaration.
+
*<code>gd</code> will take you to the local declaration.
*<tt>gD</tt> will take you to the global declaration.
+
*<code>gD</code> will take you to the global declaration.
*<tt>g*</tt> search for the word under the cursor (like <tt>*</tt>, but <tt>g*</tt> on 'rain' will find words like 'rainbow').
+
*<code>g*</code> search for the word under the cursor (like <code>*</code>, but <code>g*</code> on 'rain' will find words like 'rainbow').
*<tt>g#</tt> same as g* but in backward direction.
+
*<code>g#</code> same as g* but in backward direction.
*<tt>gg</tt> goes to the first line in the buffer (or provide a count before the command for a specific line).
+
*<code>gg</code> goes to the first line in the buffer (or provide a count before the command for a specific line).
*<tt>G</tt> goes to the last line (or provide a count before the command for a specific line).
+
*<code>G</code> goes to the last line (or provide a count before the command for a specific line).
   
 
==See also==
 
==See also==
*<tt>gf</tt> will [[VimTip299|go to the file under the cursor]]
+
*<code>gf</code> will [[VimTip299|go to the file under the cursor]]
*<tt>g]</tt> and other commands will [[Browsing_programs_with_tags|jump to a tag definition]] (a tag can be a function or variable name, or more).
+
*<code>g]</code> and other commands will [[Browsing_programs_with_tags|jump to a tag definition]] (a tag can be a function or variable name, or more).
   
 
==Comments==
 
==Comments==

Latest revision as of 05:32, July 13, 2012

Duplicate tip

This tip is very similar to the following:

These tips need to be merged – see the merge guidelines.

Tip 462 Printable Monobook Previous Next

created 2003 · complexity basic · author Nitya · version 6.0


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 (like *, but g* on 'rain' will find words like 'rainbow').
  • g# same as g* but in backward direction.
  • gg goes to the first line in the buffer (or provide a count before the command for a specific line).
  • G goes to the last line (or provide a count before the command for a specific line).

See alsoEdit

CommentsEdit

Around Wikia's network

Random Wiki