Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Vim</h2> <p>Vim has a concept called a <a href="http://VimDoc.SourceForge.Net/htmldoc/usr_21.html#21.6" rel="noreferrer">modeline</a>. A modeline is a specially formatted line either withinin the first or last 5 lines of the textfile, which allows you to <code>:setlocal</code> local variables. For example, for C:</p> <pre><code> /* vi: set filetype=c fileencoding=UTF-8 shiftwidth=4 tabstop=4 expandtab */ </code></pre> <p>or Ruby:</p> <pre><code> # vi: set filetype=ruby fileencoding=UTF-8 shiftwidth=2 tabstop=2 expandtab </code></pre> <p><a href="http://VimDoc.SourceForge.Net/htmldoc/options.html#modeline" rel="noreferrer">Some more documentation</a>.</p> <h2>Emacs</h2> <p>Emacs has a similar concept, called <a href="http://GNU.Org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables" rel="noreferrer">File Variables</a>.</p> <p>File Variables are either specified at the beginning of the file (in the first line, or if there is a shebang line, then in the second) in this form:</p> <pre><code>/* *-* mode: cc c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil *-* */ </code></pre> <p>or at the end:</p> <pre><code># Local Variables: # mode: ruby # coding: utf-8 # c-basic-offset: 2 # tab-width: 2 # indent-tabs-mode: nil # End: </code></pre> <h2>jEdit</h2> <p>jEdit calls this <a href="http://jEdit.Org/users-guide/buffer-local.html" rel="noreferrer">buffer-local properties</a>. The have to sit within the first or last 10 lines and look like this:</p> <pre><code># :mode=ruby:indentSize=2:tabSize=2:noTabs=true: </code></pre> <p>jEdit also uses the shebang line as a fallback for mode detection.</p> <h2>Komodo Edit</h2> <p>There is a plugin called <a href="http://Community.ActiveState.Com/forum/komode-modeline-support-komodo/" rel="noreferrer">Komode</a> (pun intended) which adds modeline support to Komodo Edit:</p> <pre><code># komode: le=unix language=ruby codepage=utf8 tab=2 notabs indent=2 </code></pre> <p>It also understands a limited subset of Vim modelines.</p> <h2>Others</h2> <p>A lot of other editors also have either their own variants of this, or support one of the above (usually Vim).</p> <h2>Python / Ruby encoding</h2> <p>Both Ruby 1.9 and Python require that the encoding for non-ASCII source files be explicitly specified. Fortunately, they do this in a way that is compatible with both Emacs and Vim modelines. (Basically, they look for the string <code>coding</code> followed by a non-word character followed by whitespace followed by a valid encoding name. Both Vim's <code>fileencoding=</code> and Emacs' <code>coding:</code> satisfy these requirements.)</p> <h2>Modeline Generator</h2> <p>Here is a simple <a href="http://Wireshark.Org/tools/modelines.html" rel="noreferrer">modeline generator</a>, which generates modelines for Vim, Emacs and jEdit.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload