GUI menus

[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)

Screenshots

Syntax highlighting

This screenshot shows custom highlighting of documentation blocks and .info files using the delek color scheme.

screenshot showing syntax highlighting

Plugins

Note that the lower central window is on line 113, column 38. In other words, the cursor is on the text drupal_get_path. I used <C-W>] to open the upper window on the definition of drupal_get_path(). See the description of Tag searches.

The left and right windows show the use of two Recommended plugins: the NERDTRee directory brower and the Tagbar tag browser. The current directory is for the Ctools module. Tagbar always displays tage for the currently avtive window: in this case, the core
includes/common.inc.

screenshot showing vim with split windows and the NERDTree and Tagbar plugins

Automatic completion

Other features

On this page:

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.

Tag searches

Tags files are usually created by an external program, such as Exuberant ctags. See :help 29.1 in the vim users' manual, or :help tagsrch in the reference manual, for an introduction to using tags. You can also explore the options from the Drupal.Tags menu if you are using a GUI version of vim.

Insert-mode features

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.

Comments

When editing a PHP file, start an in-line comment as usual:

  // This is a comment.
When you start a new line, the comment leader will be inserted automatically:
  // This is a comment.
  //
This is convenient, until you get to the end of your comment:
  // This is a comment.
  // This is the second and last line of the comment.
  //
To delete the comment leader (and whitespace), just type <C-U> (i.e., CTRL-U: hold down the Control key and type "u".)

Start a documentation block by entering /** and start a new line. The comment leader will be inserted automatically, with the correct indentation:

        /**
         * The first character I typed on this line was "T".
         *
         * A space was added automatically on the previous line and this one.
         * The space on the empty line was removed automatically.
         *
To close the block, just type / and vim will give you the correct **/.

Code snippets

Recommended plugins

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.

Just as Drupal has thousands of modules that extend its features, vim has thousands of plugins (and other types of scripts) that you can install. Here are some that we find useful. The Vimrc project has been tested with all of these, and adds support for some of them.

Starting with the 7.x-1.0-alpha5 release, all the plugins recommended on this page are installed automatically if you use drush vimrc-install. See the Installation page.

Start here

Pathogen:

The ultimate plugin management system. If you aren't using this, your .vim/ folder is probably a mess. We recommend that you use pathogen to install the Vimrc project, and it is helpful to manage other plugins, such as the oned we recommend on this page.
https://github.com/tpope/vim-pathogen

Vundle

Vundle works similarly to Pathogen but can control, update, install new plugins from within vim and does not rely knowledge on how to use git.
https://github.com/gmarik/vundle

Pick and choose

Fugitive

Installation

Where to get Vim

The vim home page is http://www.vim.org/, and the main download page is http://www.vim.org/download.php. Most Mac users prefer this version: http://code.google.com/p/macvim/.

To use the vimrc project, you need at least vim 7.0 with "normal" features enabled at compilation time. As of early 2012, the current version is 7.3. See Prerequisites if you are not sure what version of vim you already have.

The sections below describe

and additional steps needed for some features:

Installation with drush

$ drush @none dl vimrc
$ drush help vimrc-install
$ drush -v vimrc-install <options>

Pages

Subscribe with RSS Subscribe to RSS - text editor