<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Micah Elliott &#187; vim</title>
	<atom:link href="http://micahelliott.com/tag/vim/feed/" rel="self" type="application/rss+xml" />
	<link>http://micahelliott.com</link>
	<description>Stories from my Startup Journey</description>
	<lastBuildDate>Mon, 29 Nov 2010 07:46:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
<image>
  <link>http://micahelliott.com</link>
  <url>http://micahelliott.com/mde-gravatar7.png</url>
  <title>Micah Elliott</title>
</image>
	<!-- podcast_generator="podPress/8.8" - maintenance_release="8.8.6.3" -->
	<copyright>Copyright &#38;#xA9; Micah Elliott 2010 </copyright>
	<managingEditor>mde@micahelliott.com (Micah Elliott)</managingEditor>
	<webMaster>mde@micahelliott.com (Micah Elliott)</webMaster>
	<category>posts</category>
	<image>
		<url>http://micahelliott.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
		<title>Micah Elliott &#187; vim</title>
		<link>http://micahelliott.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>Stories from my Startup Journey</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &amp; Culture" />
	<itunes:author>Micah Elliott</itunes:author>
	<itunes:owner>
		<itunes:name>Micah Elliott</itunes:name>
		<itunes:email>mde@micahelliott.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://micahelliott.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<item>
		<title>Editor Color Scheme Philosophy</title>
		<link>http://micahelliott.com/2008/12/editor-color-scheme-philosophy/</link>
		<comments>http://micahelliott.com/2008/12/editor-color-scheme-philosophy/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 08:40:10 +0000</pubDate>
		<dc:creator>Micah</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[checklist]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://micahelliott.com/?p=194</guid>
		<description><![CDATA[I&#8217;m pretty picky when it comes to how I look at my code.  My tastes might even be a bit unique &#8212; I like things really small, colorful (earth-toned rainbow), and highly differentiated.  There are so many things that I value in a scheme that I decided to try and collect them here.  I use [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pretty picky when it comes to how I look at my code.  My tastes might even be a bit unique &#8212; I like things really small, colorful (earth-toned rainbow), and highly differentiated.  There are so many things that I value in a scheme that I decided to try and collect them here.  I use <a href="http://www.vim.org">Vim</a>, but this article should be editor-agnostic.  Have a look at my recent version of <a href="http://www.vim.org/scripts/script.php?script_id=1365">Adobe color scheme for Vim</a> that aims to satisfy the criteria of this article.</p>
<p><span id="more-194"></span></p>
<p>It&#8217;s worth mentioning that some people hate syntax highlighting, and claim that it is distracting or gives them a headache.  My guess is that most of these people have never had the chance to work with a subtle-yet-attractive color scheme.  It&#8217;s a pretty well-accepted fact syntax highlighting is useful for catching typos and various bugs.  It takes a bit of training to notice when something highlights in an unexpected way, or doesn&#8217;t highlight when it should, but an eye for it can really improve your code quality.</p>
<h2>Philosophy</h2>
<ul>
<li>Nothing should be bold unless it&#8217;s very important and should stand out above all other things. Functions/classes are good for this.  (I&#8217;m actually using a font/size now that does not support bold.)</li>
<li>Colors should be easy on eyes to stare at for many hours.  The background should be extremely comfortable for your eyes, so not white, and probably not even black.</li>
<li>Todos should stand out just a little (underline looks nice).</li>
<li>Inline comments should stand out less than anything else.</li>
<li>Code &#8220;commented out&#8221; should be nearly invisible.</li>
<li>But real in-code documentation should have strong emphasis and beauty.</li>
<li>Everything should be differentiated, including identifiers, keywords, 3-4 types of comments, strings, types, constants, conditionals, control structures, and more.</li>
<li>Strings should be a nice color since much documentation should exist in source code as strings (think &#8220;&#8221;" comments in python or /** in java).</li>
<li>Normal text should be colored either black or white so it is obvious if something is not recognized syntax.</li>
<li>No two used colors should be highly similar.  Beauty is secondary to contrast.</li>
<li>Each language will have some special syntaxes that need specific attention.  E.g., py, pl, sh, html, vim, rst, moin, mail, etc.  It&#8217;s helpful to have a variety of file types hanging around and fire up your editor on each of them for the scheme you&#8217;re developing/modifying.</li>
<li>The scheme should look nearly identical whether being used in an xterm or in a GUI.  E.g., looks the same in vim as gvim.</li>
<li>Really needs to support 256-colors.  There are just too many different highlights to try and cover in 16 colors.</li>
</ul>
<p>I&#8217;ve described the different types of comments in <a href="http://micahelliott.com/2008/12/many-types-of-code-comments">this related post</a>.</p>
<p>Have a look at <a href="http://www.vim.org/scripts/script_search_results.php?keywords=&amp;script_type=color+scheme&amp;order_by=rating&amp;direction=descending&amp;search=search">the repository of color schemes for vim</a>.  There is also a nice <a href="http://www.cs.cmu.edu/~maverick/VimColorSchemeTest/">screencapture of the repository</a>.</p>
<p><a href="http://micahelliott.com/wp-content/uploads/2008/12/pythoncomments.patch"><a href="http://micahelliott.com/wp-content/uploads/2008/12/adobe21.png"><img class="aligncenter size-full wp-image-211" title="adobe2" src="http://micahelliott.com/wp-content/uploads/2008/12/adobe21.png" alt="adobe2" width="492" height="1171" /></a><br />
</a></p>
<p>Download my <a href="http://micahelliott.com/wp-content/uploads/2008/12/pythoncomments.patch">pythoncomments</a> patch to enable <a href="http://www.vim.org/scripts/script.php?script_id=790">python.vim syntax recognizer</a> (for v2.6.3, maybe already part of your Vim installation) to make use of the various features of this article.  The patch is not necessary, but helps with some comment highlighting.</p>
]]></content:encoded>
			<wfw:commentRss>http://micahelliott.com/2008/12/editor-color-scheme-philosophy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Many Types of Code Comments</title>
		<link>http://micahelliott.com/2008/12/many-types-of-code-comments/</link>
		<comments>http://micahelliott.com/2008/12/many-types-of-code-comments/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 07:00:43 +0000</pubDate>
		<dc:creator>Micah</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[checklist]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[ocd]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://micahelliott.com/?p=196</guid>
		<description><![CDATA[It&#8217;s amazing how many different purposes there are for code comments.  Most comments are treated the same by compilers/interpreters &#8212; ignored.  But humans have their own semantics based on some established conventions.  And &#8220;meta-processors&#8221; also do a lot with these; e.g., generating documentation, running tests, executing debug statements, locating tickets, assigning to variables, syntax highlighting [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s amazing how many different purposes there are for code comments.  Most comments are treated the same by compilers/interpreters &#8212; ignored.  But humans have their own semantics based on some established conventions.  And &#8220;meta-processors&#8221; also do a lot with these; e.g., generating documentation, running tests, executing debug statements, locating tickets, assigning to variables, syntax highlighting and checking, compiler diagnostics control, editor folding, hidden full-blown languages, and probably even more.  But the point of this post is to simply enumerate the common comment types.  I&#8217;m working on some syntax highlighting for <a href="http://www.vim.org">Vim</a> to make more semantic sense of these, particularly for Python code.</p>
<p><span id="more-196"></span></p>
<h2>Different Types of Comments</h2>
<p>Of course the code highlighting plugin this blog uses isn&#8217;t able to make much sense of these, but Vim can take it further with a little tweaking.</p>
<pre name="code" class="python"># look out for...
#print 'disabled
##print 'disabled'
for x in xs:  # iterate over xs
### King comment.
###print x
"""Multi-line chunk of commented-out code.  Sometimes only first sentence is significant."""
'''multi-line chunk of docstring'''
"string"
'string'
# TODO: add locking to...
######################################################################
#---------------------------------------------------------------------
# @param foo The metavar that never dies</pre>
<p>I&#8217;ll break these down by line number.</p>
<ol>
<li>is just a traditional comment that exists because something out of the ordinary is happening around the code.</li>
<li>a disabled line of code</li>
<li>another disabled line that is easier for a highlighter to treat.</li>
<li>an end-of-line comment; the most subtle form.</li>
<li>is a descriptive comment marking the purpose of a section of code.</li>
<li>a statement that only executes when in &#8220;debug mode&#8221;.  Perl&#8217;s &#8220;smart comments&#8221; are the only facility I&#8217;m aware of that uses this, but I think they&#8217;re pretty clever.</li>
<li>a formal piece of documentation, usually spanning multiple lines.</li>
<li>a simple way to comment out a large chunk of code.</li>
<li>just a string</li>
<li>same as 7; probably should not be differentiated, but some people prefer to the &#8220;dirk&#8221; version whenever possible.</li>
<li>a codetag (a controversial convention many use to refer to items that should (or do) have tracker tickets associated; described in <a href="http://www.python.org/dev/peps/pep-0350/">PEP 350</a>).</li>
<li>a break in major section of the file.</li>
<li>a minor section break.</li>
<li>a &#8220;javadoc&#8221;-style piece of documentational markup.  Also available with <a href="http://epydoc.sourceforge.net/manual-fields.html#epydoc-fields">Epydoc</a>.</li>
</ol>
<h2>View From Vim</h2>
<p>For a more visual example, here&#8217;s a screenshot showing the best I can make Vim do today.  Featuring the <a href="http://www.vim.org/scripts/script.php?script_id=1365">Adobe color theme</a>, tokenized by <a href="http://www.vim.org/scripts/script.php?script_id=790">python.vim</a>.</p>
<p><img class="aligncenter size-full wp-image-204" title="vim1" src="http://micahelliott.com/wp-content/uploads/2008/12/vim11.png" alt="vim1" width="492" height="523" /></p>
<p>It is certainly within reach to make Vim, emacs, and probably many other editors make use of these semantics in their syntax highlighting.  That color scheme (hacked up for this display) is not (yet) perfect, but it does the job of showing most of the differentiation.  If there are so many purposes for the different comments, shouldn&#8217;t your editor make those differences obvious?</p>
<p>I&#8217;ll offer more details about getting this working, and the value of highly differentiated syntax, and what makes a good color scheme, in a near-future post.</p>
]]></content:encoded>
			<wfw:commentRss>http://micahelliott.com/2008/12/many-types-of-code-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

