This project customizes the vim text editor for editing Drupal-related files. Who needs an IDE?

This project started as a single vimrc file, but that made it difficult to use Vim for non-Drupal work. The project now is plugin-based for ease of use and extension.

We have extensive documentation, including installation instructions.

See also the Configuring vim page in handbook, although most of the suggestions there have already been incorporated into this project.

Installation for the impatient

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

The following screenshot is described on the Insert-mode features page in our section of the developers' handbook.

Screenshot of vim in action with omni-completion

As of this writing, the project includes the following files. (See README.txt for a complete, updated list.)

This sets several vim options to appropriate values for editing PHP files, to make it easier to follow Drupal coding standards. It also defines the following mappings:
Look up the API docs for a drupal function under the cursor and open it in a web browser.
Same as \da but use
Look up the API docs for a drush function under the cursor and open it in a web browser.
Get the value of the drupal variable under cursor. (Requires drush.)

You can define the maplocalleader variable to be something other than the default if you do not want these maps to start with a backslash.

To start a documentation block, type /**<CR>. The indent and the leading * will be added. To close the block, type <CR>/. For // style comments, the comment leader will be inserted on new lines; to remove it at the end of the comment, use <C-U>. To adjust line breaks in any comment, use gq.

The file plugin/drupal.vim sets several options. These will apply whether or not you are editing Drupal-related files. In addition, it sets filetype detection and ftplugin support on; sets global variables used by the PHP syntax file; defines several key mappings; and it highlights trailing whitespace and comment lines longer than 80 characters in PHP and CSS files.
Vim help file. If the entire project is installed as ~/.vim, so the help file is at ~/.vim/doc/drupal.txt, then you can read the docs within vim using
    :helptags ~/.vim/doc
    :help drupal

The :helptags line only needs to be done once, when you install (or update) the help file. See :help :helptags.

This file contains autocommands that recognize .module, .php, .install, .inc, .profile, .theme, .engine, and .test files as PHP and .info, .make, and .build files as Drupal ini.
Installation instructions, etc.
Code for addding GUI menus to vim.
Support for code clean-up using the Coder module.
Tags files to support code navigation and omni-copletion.
Mappings and settings for editing Drupal ini files.
Support for the href="">snipMate plugin for
Syntax highlighting for Drupal PHP and ini files.
Example vimrc files for those who have never bothered to customize vim.

Project information

  • chart icon9,718 downloads
  • shieldStable releases for this project are covered by the security advisory policy.
    Look for the shield icon below.