GUI menus

Last updated on
25 April 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

[Tag commands: Drupal.Tags | Top-level commands | Configuration: Drupal.Configure]

The Vimrc Project

This page is part of the documentation for the vimrc project. For other documentation pages, check the links in the sidebar or go to the top documentation page.

Experienced vim users recognize that the keyboard is faster than the mouse, but even die-hard keyboard jockeys will admit that GUI menus are helpful for some tasks and for learning the key strokes that you will use regularly.

If you are using a GUI version of vim (as opposed to running vim in a terminal window) then there are several options available under the Drupal menu. You can add your own menus, including command-line hints, using drupal#CreateMaps(). Example:

        :let s:options = {'root': 'Drupal', 'special': '<buffer>'}
        :nmap <Plug>DrupalAPI :silent call <SID>OpenURL("api.d.o")<CR><C-L>
        :call drupal#CreateMaps('n', 'Drupal API', '<LocalLeader>da', '<Plug>DrupalAPI', s:options)

These lines (from ftplugin/drupal.vim) define the menu item 'Drupal.Drupal API' with the command-line hint \da, calling the s:OpenURL() function to open http://api.drupal.org on the page describing the function under the cursor. The 'n' argument indicates that this menu item is available only in Normal mode.

Some menu items perform complicated or rarely-used tasks. Others are there mostly to teach you the keyboard shortcuts. Here is a summary of the menus:

Tag under cursor
Jump to the definition of the keyword under the cursor. CTRL-]
Ditto, split window
Open a new window and jump to the definition of the keyword under the cursor. CTRL-W_]
Got to a tag.
Enter a tag, such as node.module, on the command line. :tag
Ditto, split window
Enter a tag on the command line and split the window. :stag
Search for tag.
Enter a pattern, such as drupal_set_ or node_.*form\>, on the command line. :tag
Ditto, split window
Enter a pattern on the command line and split the window. :stag
Choose one match.
See a list of all tag matches for the previous tag command and jump to one of them. Even if you use a complete tag, there may be multiple matches. For example, execute is defined for several database-related classes. :tselect
tag-gen options
Show the help text for the vimrc-tag-gen drush command, using :Drush.
tag-gen current project
Generate a tags file for the current project (module, theme, etc.) using vimrc-tag-gen.
tag-gen Drupal root
Generate a tags file for the Drupal root directory using vimrc-tag-gen. See $DRUPAL_ROOT.

The three tag-gen menu items are only present if exuberant ctags is in your path or one of /usr/bin/ or /usr/local/bin/.

Drupal API
Lookup the API docs for a drupal function under cursor. drupal-\da
Drupal hook
Lookup the API docs for a hook implemented by the drupal function under the cursor. drupal-\dh
Drupal contrib
Same as \da but use http://drupalcontrib.org/. drupal-\dc
Drush API
Lookup the API docs for a drush function under cursor. drupal-\dda
Get variable
Get the value of the drupal variable under cursor. (Requires drush.) drupal-\dv

The menu items that open a web browser are only present if one of the commands open (Mac), start (Windows), or xdg-open (Linux) is available.

Set Drupal root
If the script cannot guess the location of your Drupal root directory, you can set it using this item. See g:Drupal_dirs to set permanent defaults.
Show Drupal info
Show the current value of b:Drupal_info.

Help improve this page

Page status: No known problems

You can: