Drupal : A very simple plugin to help develop with Drupal
script karma |
Rating 4/1,
Downloaded by 893 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Sébastien |
|
script type |
utility |
|
description |
Simple plugin for VIm to help develop with Drupal.
It's the tool I use for my works, so it will probably include more features in the future.
But... It is not supposed to become a huge plugin because one of the reasons I like VI is its lightness, so...
This + Drush + the rest of my VIm config is enough for me, I don't want an editor that take too much memory.
---
FOR A COMPLETE DOCUMENTATION, READ THE FILE HEADER:
ALL IS EXPLAINED AND PROBABLY MORE UP2DATE THAN ON THIS PAGE!
---
USAGE:
- "ResetVimDrupalCache" command: ** args: none **
Reset the internal cache.
Use it if a new module/theme/file is not autocompleted.
- "Hook" command: ** args: {hook_name} **
Implement the named hook, where the cursor is.
For convinience, the module name is guessed by the file path,
when this is ambiguous or indeterminate, a prompt is displayed.
A cache (renewed each time vim is opened) is used to not ask
several times for the same file in which module it is associated.
Note that:
- If the hook implementation already exists (and found by ctags),
a new function is NOT created: The cursor is placed on this instead.
- If the hook contains a specific part (like hook_form_FORM_ID_alter),
a dialog will ask what use for it (in this example value of FORM_ID)
- "EditDrupal" command: ** args: {module / theme} {filepath} **
Edit a Drupal file. /!\ Require Drush! /!\
{module / theme} is the (machine) name of a module or a theme,
{filepath} is the path of a file, relative to this module / theme
You can use "/" as module argument: It will point to the Drupal root.
Some file are excluded from the autocomplete list.
By default: *.png, *.gif, *.jpg and *.jpeg
You can change which ones by adding (and adapting) this to your .vimrc:
let g:Drupal_excluded_extensions = 'png,gif,jpg,jpeg'
(coma separated file extensions to exclude, or empty to allow all files)
---
If you want to be sure having the last version of this plugin, check my github repository (in case of I forgot to update here):
https://github.com/webastien/vim/blob/master/vim/plugin/drupal.vim
On github, you will also find my VIm configuration. Feel free to extract parts of code you need from my sources.
This could be better but I use those for my daily works without problems and it will be improved over the time.
I always miss time to refactor and clean the code, so if you want to help, you're welcome ;-) |
|
install details |
Required:
- Drop this file to your plugin directory of vim.
Recommanded:
- Install Drush! http://drupal.org/project/drush/
/!\ "EditDrupal" command will not work without!
- Add an abbreviation for "EditDrupal" command.
To do it, add this to your .vimrc:
cabbrev YOURABBR <c-r>= ((getcmdtype() == ':' && getcmdpos() == 1)? 'EditDrupal': 'YOURABBR')<CR>
(where YOURABBR is the abbreviation you've choosed)
Example: cabbrev ed <c-r>= ((getcmdtype() == ':' && getcmdpos() == 1)? 'EditDrupal': 'ed')<CR>
Now, when you are in command mode, type ed<space> and 'ed' has been replaced by 'EditDrupal'.
Optional:
- Map a key to call the "ResetVimDrupalCache" command.
To do it, add this to your .vimrc:
nmap YOURKEY :ResetVimDrupalCache<CR>
(where YOURKEY is the key you've choosed)
Example: nmap <F10> :ResetVimDrupalCache<CR> |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.97.14.85
|