Grayside.Org

Home

Using Nano with Drupal

grayside — Thu, 11/12/2009 - 11:12

Janak Singh had a great introduction to tailoring Nano for use with Drupal. Here are the details of how I use Nano.

Because Drupal is not my entire PHP universe, I have created a separate syntax file specific to the sorts of files I typically use with Drupal. My drupal.nanorc is almost identical to my php.nanorc, but it highlights hook statements in comments and adds some extra coloring to drupal core API functions.

I identify Drupal API functions by two alternate criteria:

  1. The function starts with drupal_
  2. I've noticed myself using the function and remembered to add it.

It would be really helpful if a master API existed that excluded all the internal functions I will only ever need as background reference material. (It's necessary to limit the functions in this way to avoid annoying 10 second .nanorc parsing times.)

drupal.nanorc

Here are some highlights from the attached file.

# Drupal syntax highlighting
syntax "drupal" "\.module$" "\.install$" "\.inc$" "\.view$" "\.tpl.php$"
# Drupal API functions
color blue "(arg|base_path|cache_get|cache_set|check_file|check_markup|check_plain)\W"
color blue start="drupal_" end="\W"
# Emphasize hooks in comments
color brightgreen start="hook_" end=")"

Invoking Nano

For Drupal development, a simple alias to Nano in my .bashrc file switches it from general purpose to Drupal Coding.
alias nani='nano -i -E -T 2'
This enforces auto-indent, converts tabs to spaces, and resizes tab width to two spaces. This saves me a lot of time counting spaces for coding standards.

Attachment: 
application/octet-stream icon
Drupal Syntax Highlighting for Nano
  • development
  • drupal
  • nano
  • Add new comment

Similar Posts

  • CCK Fields and the Open Atrium Node Form
  • Overriding Prepopulate: Do Not Use hook_form_FORM_ID_alter
  • Atrium Casetracker: Change Which Case Statuses are "Closed"
  • Casetracker with Subtasks
  • Freelinking 3: Forging Ahead

Monthly archive

  • March 2010 (4)
  • February 2010 (2)
  • November 2009 (7)
  • October 2009 (1)
  • September 2009 (5)
  • August 2009 (1)
  • July 2009 (1)

Feeds

Syndicate contentHeadlines

casetracker cck drupal fields FL3 freelinking how-to module node-form openatrium permissions plugin
<all>

© 2009 grayside.org ♠ Glossary ♠ Powered by Drupal ♠ Floating on Archlinux