design background image
design background image
design background image

Configuring Nano for Drupal coding

According to Drupal's coding standards, indentations should be in the form of 2 spaces, not tabs. Not to difficult, unless you've got that tab key ingrained in you. No need to re-train yourself on the spacebar, however, most good editors allow you to set the tab length and switch between spaces or tabs for indentation. Nano is no different, so let's take a look at how.

To configure Nano, you just need to edit (or create) a file named .nanorc in your home directory:

nano ~/.nanorc

Then add or un-comment the following lines:

## Use this tab size instead of the default; it must be greater than 0.
set tabsize 2
## Convert typed tabs to spaces.
set tabstospaces

As a bonus tip: if you're using Nano in Ubuntu, you may have notice that the Backspace key is acting like the Delete key instead. To fix the Backspace key in Nano, add the following line to your .nanorc file:

set rebinddelete

There you go, tabbing and backspacing to your heart's content.