Editor Modeline Generator

Suppose you have some code which may be editied by people with different text editors and coding style preferences. As discussed by Jamie Zawinski, indentation width, tab width, and indentation behavior can vary widely and can often be a religious (and in the case of Python, sanity) issue.

Some editors are nice enough to let you configure indentation and tab behavior inside the file you're editing. This feature has many different names, such as "modelines," "buffer-local properties", or "file variables". We use the term "modline" here.

The form below lets you create modeline blurbs that you can copy and paste into the file you're editing. Simply select the settings you would like to apply, then copy and paste. You can also create modelines from a set of existing coding styles below.

You might also want to check out EditorConfig, which sets coding styles on a per-directory and per-project basis instead of per-file.

How wide should each indentation level be?

A horizontal tab character (U+0009) should advance the cursor to the next multiple of...

Should tab characters be replaced with an equivalent number of spaces?

What comment characters do you require?

Top Modeline

Place this at the beginning of your file:

Bottom Modeline

Place this at the end of your file:

Official Coding Standards

Coding Standards (click to set)
Coding Standard Indentation Width Tab Width Tab Key Makes
Python 4 ? Spaces
Linux 8 8 Tabs
Java 4 8 ?
Microsoft Visual C++ 4 4 Tabs
Microsoft Visual C# 4 4 Spaces
Microsoft Visual Basic 4 4 Spaces
Microsoft Visual Studio 2010 4 4 Tabs
Perl 4 ? ?
PHP (Zend) 4 ? Spaces
Ruby 2 ? Spaces

Editor Modeline Documentation

Visual Studio modeline support is available via the exTabSettings addin.

Most of the editor- and language-specific information was gathered from a hastily done survey. If you have corrections, please open a bug.

The generator doesn't address braces and other styling issues. This is on purpose.

If you are a text editor developer and want to add modeline / file variable / buffer-local property support, please consider adding support for Emacs or vim syntax. If we keep adding support for a bunch of slightly-different syntaxes we'll run out of room.


Go Beyond with Riverbed Technology

Riverbed is Wireshark's primary sponsor and provides our funding. They also make great products that fully integrate with Wireshark.

I have a lot of traffic...

ANSWER: SteelCentral™ Packet Analyzer PE
  • • Visually rich, powerful LAN analyzer
  • • Quickly access very large pcap files
  • • Professional, customizable reports
  • • Advanced triggers and alerts
  • • Fully integrated with Wireshark and AirPcap™
Learn More

Buy Now

No, really, I have a LOT of traffic…

ANSWER: SteelCentral™ NetShark appliance
  • • Troubleshoot problems faster
  • • Quickly identify the applications running on your network
  • • Monitor your virtual machine traffic
Learn More

I need to capture wireless traffic...

ANSWER: AirPcap™ 802.11 Packet Capture
  • • WLAN packet capture and transmission
  • • Full 802.11 a/b/g/n support
  • • View management, control and data frames
  • • Multi-channel aggregation (with multiple adapters)
Learn More Buy Now