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
  • How to Override a Views Field Template from a Module
  • Modifying Contexts the Old-Fashioned Way
  • Firefox's Custom Keywords and Drupal
  • Optional Spaces Integration for a View

Monthly archive

  • September 2010 (3)
  • August 2010 (2)
  • July 2010 (2)
  • June 2010 (6)
  • May 2010 (9)
more

Feeds

  • Syndicate contentHeadlines
  • Syndicate contentDrupal Planet
  • Syndicate contentAtrium Headlines

casetracker cck drupal features FL3 freelinking module og openatrium permissions spaces views
<all>

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