<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>chys&#039;s random notes &#187; Emacs</title>
	<atom:link href="http://en.chys.info/tag/emacs/feed/" rel="self" type="application/rss+xml" />
	<link>http://en.chys.info</link>
	<description>Study more problems; Talk less of isms.</description>
	<lastBuildDate>Tue, 27 Dec 2011 11:56:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>VIM modelines</title>
		<link>http://en.chys.info/2009/02/vim-modelines/</link>
		<comments>http://en.chys.info/2009/02/vim-modelines/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 23:23:04 +0000</pubDate>
		<dc:creator>chys</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[VIM]]></category>

		<guid isPermaLink="false">http://blog.chys.info/?p=255</guid>
		<description><![CDATA[I was wondering why all Emacs modeline samples I found online worked so well, but no VIM ones worked at all. In fact, VIM by default disables modelines because it is a potential security hole. (This is too bad. They can enable only safe instructions by default.) Add set modeline to ~/.vimrc to enable it. [...]<hr/>
Related posts:<ol>
<li><a href='http://en.chys.info/2009/03/vim-sessions/' rel='bookmark' title='VIM sessions'>VIM sessions</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I was wondering why all Emacs modeline samples I found online worked so well, but no VIM ones worked at all. <del datetime="2009-03-11T02:52:10+00:00">In fact, VIM by default disables modelines because it is a potential security hole. (This is too bad. They can enable only safe instructions by default.)</del> Add <code>set modeline</code> to <code>~/.vimrc</code> to enable it.</p>
<p>A modeline is some instructions to the editor put in the comments, usually in the beginning of a text file. The most common use is probably to set the syntax highlighting rule, tab width and indent.</p>
<p>Modeline example:<br />
<code>/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */</code><br />
<code>/* vim:set ft=cpp ts=2 sw=2 sts=2 cindent: */</code></p>
<p>The first line is for Emacs and the second for VIM. <del datetime="2009-03-10T05:45:57+00:00">Note that an Emacs modeline must appear in the beginning of a file, while VIM modelines can be put anywhere.</del></p>
<p>Basicly, these two lines force the file type to be C++ (especially useful for <code>.h</code> files, which are by default treated as C sources), set the width of a tab to be 2 characters and enable auto indention. (My knowledge about Emacs is very limited, so probably this is not accurate.)</p>
<p>Some resources:<br />
1. <a href="http://www.delorie.com/gnu/docs/emacs/emacs_486.html">GNU Emacs modeline documentation</a><br />
2. <a href="http://vimdoc.sourceforge.net/htmldoc/options.html#modeline">VIM modeline documentation</a></p>
<hr/><p>Related posts:<ol>
<li><a href='http://en.chys.info/2009/03/vim-sessions/' rel='bookmark' title='VIM sessions'>VIM sessions</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://en.chys.info/2009/02/vim-modelines/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

