<?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>Serendip &#187; vim</title>
	<atom:link href="http://www.serendip.ws/archives/tag/vim/feed" rel="self" type="application/rss+xml" />
	<link>http://www.serendip.ws</link>
	<description>Webデザイン・プログラミング</description>
	<lastBuildDate>Fri, 10 Feb 2012 05:33:58 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>vimshell で Clojure を実行する</title>
		<link>http://www.serendip.ws/archives/4805</link>
		<comments>http://www.serendip.ws/archives/4805#comments</comments>
		<pubDate>Mon, 10 May 2010 14:04:22 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=4805</guid>
		<description><![CDATA[Vim Plugin の vimshell (Shougo&#8217;s vimshell at master &#8211; GitHub) 上で Clojure を実行させてみた。 実行した環境は Ubuntu 1 [...]]]></description>
			<content:encoded><![CDATA[<p>Vim Plugin の vimshell (<a href="http://github.com/Shougo/vimshell" class="out" rel="external">Shougo&#8217;s vimshell at master &#8211; GitHub</a>) 上で Clojure を実行させてみた。<br />
実行した環境は Ubuntu 10.04 と Mac OSX Snow Leopard。</p>
<p>vimshell は git でダウンロードする。</p>
<pre>$ git clone git://github.com/Shougo/vimshell.git
</pre>
<p>ダウンロードしたファイルをそれぞれ ~/.vim 以下にコピーする。</p>
<p>vimshell 上で Clojure の REPL を動かすには、vimproc を使って非同期実行する必要があるようなので vimproc も git でダウンロードする。</p>
<pre>$ git clone git://github.com/Shougo/vimproc.git
</pre>
<p>そして、proc.so を <code>make</code> する。</p>
<pre>$ make -f make-gcc.mak <span class="Comment"># Ubuntu</span>
$ make -f make-mac.mak <span class="Comment"># Mac</span>
</pre>
<p>コンパイル後に作成した proc.so と vimproc.vim を ~/.vim/autoload/ へコピーし、doc/vimproc.jax を ~/.vim/doc/ へコピーする。<br />
~/.vim/ を Dropbox で共有していたので、Ubuntu 用と Mac 用とに分けるために、それぞれ procmac.so、procunix.so としてコピーした。</p>
<p>.vimrc に以下の設定を記述する。</p>
<pre><span class="Comment">&quot; vimproc</span>
<span class="Statement">if</span> <span class="Identifier">has</span><span class="Special">(</span><span class="Constant">'mac'</span><span class="Special">)</span>
    <span class="Statement">let</span> g:vimproc_dll_path <span class="Statement">=</span> <span class="PreProc">$HOME</span><span class="Statement">.</span><span class="Constant">&quot;/.vim/autoload/procmac.so&quot;</span>
<span class="Statement">elseif</span> <span class="Identifier">has</span><span class="Special">(</span><span class="Constant">'unix'</span><span class="Special">)</span>
    <span class="Statement">let</span> g:vimproc_dll_path <span class="Statement">=</span> <span class="PreProc">$HOME</span><span class="Statement">.</span><span class="Constant">&quot;/.vim/autoload/procunix.so&quot;</span>
<span class="Statement">endif</span>

<span class="Comment">&quot; vimshell</span>
<span class="Statement">let</span> g:VimShell_EnableInteractive <span class="Statement">=</span> <span class="Constant">1</span>
</pre>
<p><code>VimShellInteractive</code> による Clojure REPL の起動と、<code>VimShellSendString</code> で選択範囲のコードを vimshell 上の Clojure REPL に送るためのキーバインド設定を行う。<br />
~/.vim/ftplugin/clojure/vimshell-clojure.vim ファイルを作成して以下の記述をする。</p>
<pre>:<span class="Statement">command</span>! CLJVimShell execute <span class="Constant">&quot;:VimShellInteractive clj&quot;</span>

<span class="Statement">vmap</span> <span class="Special">&lt;</span><span class="Special">silent</span><span class="Special">&gt;</span> ,s :VimShellSendString<span class="Special">&lt;</span><span class="Special">cr</span><span class="Special">&gt;</span>
</pre>
<p>これで、vimshell を起動して、Clojure のコードを選択し、<kbd>,s</kbd> キーを押下すると vimshell 上の Clojure REPL でコードが実行される。</p>
<p><img src="http://www.serendip.ws/wordpress/wp-content/uploads/clojure_on_vimshell_20100510_001.png" alt="vimshell 上で Clojure を実行中" title="vimshell 上で Clojure を実行中" width="444" height="364" class="size-full wp-image-4807" /></p>
<p>VimClojure に比べてサーバの起動は不要だし、シェルがシンタックスハイライトされるし、neocomplcache で補完が使えるので、イイ♪</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/4805/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim :edit コマンド from Vimcasts</title>
		<link>http://www.serendip.ws/archives/4681</link>
		<comments>http://www.serendip.ws/archives/4681#comments</comments>
		<pubDate>Wed, 07 Apr 2010 06:21:56 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=4681</guid>
		<description><![CDATA[The :edit command 今まで、無意識に :e をタイプしていたれど、:edit コマンドの e だったんだ。 Vimcasts (vimcasts.org)]]></description>
			<content:encoded><![CDATA[<p><a href="http://vimcasts.org/episodes/the-edit-command/" class="out" rel="external">The :edit command</a></p>
<p>今まで、無意識に <code>:e</code> をタイプしていたれど、<code>:edit</code> コマンドの <code>e</code> だったんだ。</p>
<p><a href="http://vimcasts.org/" class="out" rel="external">Vimcasts</a> (vimcasts.org)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/4681/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim の Sparkup プラグインで HTML タグを Zen Coding 風に簡単入力</title>
		<link>http://www.serendip.ws/archives/4353</link>
		<comments>http://www.serendip.ws/archives/4353#comments</comments>
		<pubDate>Wed, 17 Feb 2010 07:42:26 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=4353</guid>
		<description><![CDATA[Vim プラグインの Sparkup (rstacruz&#8217;s sparkup at master &#8211; GitHub) で、CSS セレクタ風の記述から HTML タグ文字列を入力することができる。 [...]]]></description>
			<content:encoded><![CDATA[<p>Vim プラグインの Sparkup (<a href="http://github.com/rstacruz/sparkup" class="out">rstacruz&#8217;s sparkup at master &#8211; GitHub</a>) で、CSS セレクタ風の記述から HTML タグ文字列を入力することができる。（<a href="http://code.google.com/p/zen-coding/" class="out">zen-coding</a> 風の入力）</p>
<p>プラグインのインストールは上記サイトからダウンロードしたファイル内の vim/ftplugin/ 内のファイルを ~/.vim/ftplugin/ にコピーする。<br />
プラグインの実行には python2.5 以上が必要。</p>
<p><kbd>&lt;c-e&gt;</kbd> を押すことで、タグキーワード（<code>div</code>, <code>h1</code>, <code>img</code>, <code>meta</code> 等）から開始タグ・終了タグ・各種属性を自動で入力できる。</p>
<p><kbd>&lt;c-n&gt;</kbd> を押すことでカーソルを次の入力位置に移動できる。</p>
<p>CSS 風のセレクタ表記を使ったショートカット文字列から HTML タグ文字列に展開される。</p>
<h3>タグ単体の入力</h3>
<p>タグキーワードを入力して <kbd>&lt;c-e&gt;</kbd> を押す。</p>
<pre>div <span class="Comment">&lt;= &lt;c-e&gt; を押す</span>

<span class="Identifier">&lt;</span><span class="Statement">div</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
</pre>
<h3>属性値を含めて入力</h3>
<p><code>id</code> の場合は <code>#</code> 、<code>class</code> の場合は <code>.</code> でタグキーワードと属性値を繋ぐ。<br />
タグを省略した場合は <code>div</code> タグとして処理される。</p>
<pre>div#hoge.foo <span class="Comment">&lt;= id が hoge, class が foo の div タグ</span>

<span class="Identifier">&lt;</span><span class="Statement">div</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;foo&quot;</span><span class="Identifier"> </span><span class="Type">id</span><span class="Identifier">=</span><span class="Constant">&quot;hoge&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
</pre>
<p>その他の属性値の場合は属性名を指定する。</p>
<pre>a[href=http://www.google.com/].foo#hoge <span class="Comment">&lt;= id が hoge, class が foo の Google へのリンク</span>

<span class="Identifier">&lt;</span><span class="Statement">a</span><span class="Identifier"> </span><span class="Type">href</span><span class="Identifier">=</span><span class="Constant">&quot;http://www.google.com/&quot;</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;foo&quot;</span><span class="Identifier"> </span><span class="Type">id</span><span class="Identifier">=</span><span class="Constant">&quot;hoge&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">a</span><span class="Identifier">&gt;</span>

img[width][height][title=テスト] <span class="Comment">&lt;= width, height 属性を持ち title テキストが&quot;テスト&quot;の img タグ</span>

<span class="Identifier">&lt;</span><span class="Statement">img</span><span class="Identifier"> </span><span class="Type">width</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier"> </span><span class="Type">src</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier"> </span><span class="Type">height</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier"> </span><span class="Type">alt</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier"> </span><span class="Type">title</span><span class="Identifier">=</span><span class="Constant">&quot;テスト&quot;</span><span class="Identifier"> /&gt;</span>
</pre>
<h3>タグに囲まれたテキスト</h3>
<p>タグに囲まれたテキストは <code>{}</code> で囲んだテキストを繋ぐ。</p>
<pre>a[href]{This is link test}

<span class="Identifier">&lt;</span><span class="Statement">a</span><span class="Identifier"> </span><span class="Type">href</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier">&gt;</span><span class="Underlined">This is link test</span><span class="Identifier">&lt;/</span><span class="Statement">a</span><span class="Identifier">&gt;</span>
</pre>
<h3>子要素を含めて入力</h3>
<p>子要素を含めて入力する場合は、子要素を <code>&gt;</code> で繋ぐ。</p>
<pre>div &gt; span.wrap <span class="Comment">&lt;= class が wrap の span タグを子要素に持つ div タグ</span>

<span class="Identifier">&lt;</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">span</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;wrap&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">span</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;/</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
</pre>
<h3>要素を連続して入力</h3>
<p>要素を連続して複数入力する場合は、要素名の後に <code>*<var>n</var></code> のようにして <code>*</code> と要素数を記述する。</p>
<pre>select &gt; option*4 <span class="Comment">&lt;= 4つの option タグを持つ select タグを入力</span>

<span class="Identifier">&lt;</span><span class="Statement">select</span><span class="Identifier"> </span><span class="Type">name</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;/</span><span class="Statement">select</span><span class="Identifier">&gt;</span>
</pre>
<h3>連続して入力するタグに連番を使った処理を加える</h3>
<p>連続して入力するタグに <code>$</code> の記述を追加すると連番に展開される。</p>
<pre>select &gt; option[value=$].item-$*5 <span class="Comment">&lt;= 5つの option タグの value と class に連番を加える</span>

<span class="Identifier">&lt;</span><span class="Statement">select</span><span class="Identifier"> </span><span class="Type">name</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;item-1&quot;</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;1&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;item-2&quot;</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;2&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;item-3&quot;</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;3&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;item-4&quot;</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;4&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">option</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;item-5&quot;</span><span class="Identifier"> </span><span class="Type">value</span><span class="Identifier">=</span><span class="Constant">&quot;5&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">option</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;/</span><span class="Statement">select</span><span class="Identifier">&gt;</span>
</pre>
<h3>隣接した異るタグを入力する</h3>
<p>同じ階層の隣接した異なるタグ（タグ自身や属性の相違）を続けて入力するには <code>+</code> で各タグを繋いていく。</p>
<pre>p.foo + p.hoge + img

<span class="Identifier">&lt;</span><span class="Statement">p</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;foo&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">p</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;</span><span class="Statement">p</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;hoge&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">p</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;</span><span class="Statement">img</span><span class="Identifier"> </span><span class="Type">src</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier"> </span><span class="Type">alt</span><span class="Identifier">=</span><span class="Constant">&quot;&quot;</span><span class="Identifier"> /&gt;</span>
</pre>
<h3>階層を1つ上に戻す</h3>
<p><code>&lt;</code> を使うことで1度掘り下がった階層を1つ上に戻すことができる。</p>
<pre>div &gt; ul &gt; li.items*3 &lt; p.foot &lt; #foot

<span class="Identifier">&lt;</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">ul</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">li</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;items&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">li</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">li</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;items&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">li</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">li</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;items&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">li</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;/</span><span class="Statement">ul</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">p</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;foot&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">p</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;/</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;</span><span class="Statement">div</span><span class="Identifier"> </span><span class="Type">id</span><span class="Identifier">=</span><span class="Constant">&quot;foot&quot;</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">div</span><span class="Identifier">&gt;</span>
</pre>
<h3>少し複雑なテーブルを作る</h3>
<pre>table[border=1] &gt; tr*3 &gt; th.title{TITEL} + td*2{CONTENTS} + td.foot{FOOTER} &lt; tr &gt; th.foot[colspan=4]{FOOTER}

<span class="Identifier">&lt;</span><span class="Statement">table</span><span class="Identifier"> </span><span class="Type">cellspacing</span><span class="Identifier">=</span><span class="Constant">&quot;0&quot;</span><span class="Identifier"> </span><span class="Type">border</span><span class="Identifier">=</span><span class="Constant">&quot;1&quot;</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">tr</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">th</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;title&quot;</span><span class="Identifier">&gt;</span>TITEL<span class="Identifier">&lt;/</span><span class="Statement">th</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier">&gt;</span>CONTENTS<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier">&gt;</span>CONTENTS<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;foot&quot;</span><span class="Identifier">&gt;</span>FOOTER<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;/</span><span class="Statement">tr</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">tr</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">th</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;title&quot;</span><span class="Identifier">&gt;</span>TITEL<span class="Identifier">&lt;/</span><span class="Statement">th</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier">&gt;</span>CONTENTS<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier">&gt;</span>CONTENTS<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;foot&quot;</span><span class="Identifier">&gt;</span>FOOTER<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;/</span><span class="Statement">tr</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">tr</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">th</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;title&quot;</span><span class="Identifier">&gt;</span>TITEL<span class="Identifier">&lt;/</span><span class="Statement">th</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier">&gt;</span>CONTENTS<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier">&gt;</span>CONTENTS<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">td</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;foot&quot;</span><span class="Identifier">&gt;</span>FOOTER<span class="Identifier">&lt;/</span><span class="Statement">td</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;/</span><span class="Statement">tr</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;</span><span class="Statement">tr</span><span class="Identifier">&gt;</span>
        <span class="Identifier">&lt;</span><span class="Statement">th</span><span class="Identifier"> </span><span class="Type">colspan</span><span class="Identifier">=</span><span class="Constant">&quot;4&quot;</span><span class="Identifier"> </span><span class="Type">class</span><span class="Identifier">=</span><span class="Constant">&quot;foot&quot;</span><span class="Identifier">&gt;</span>FOOTER<span class="Identifier">&lt;/</span><span class="Statement">th</span><span class="Identifier">&gt;</span>
    <span class="Identifier">&lt;/</span><span class="Statement">tr</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;/</span><span class="Statement">table</span><span class="Identifier">&gt;</span>
</pre>
<table cellspacing="0" border="1">
<tr>
<th class="title">TITEL</th>
<td>CONTENTS</td>
<td>CONTENTS</td>
<td class="foot">FOOTER</td>
</tr>
<tr>
<th class="title">TITEL</th>
<td>CONTENTS</td>
<td>CONTENTS</td>
<td class="foot">FOOTER</td>
</tr>
<tr>
<th class="title">TITEL</th>
<td>CONTENTS</td>
<td>CONTENTS</td>
<td class="foot">FOOTER</td>
</tr>
<tr>
<th colspan="4" class="foot">FOOTER</th>
</tr>
</table>
<h3>HTML タグ・テンプレートの入力</h3>
<p>各 DOCTYPE 宣言を含んだ HTML タグ・テンプレート を入力する。<br />
<code>html:</code> の後に各 DOCTYPE 宣言のショートカット文字列(<var>type</var>)を記述する。</p>
<p><code>html:<var>type</var></code></p>
<p>各 DOCTYPE 宣言とショートカットの一覧</p>
<dl>
<dt>HTML 4.01 Transitional</dt>
<dd><code>html:4t</code></dd>
<dt>HTML 4.0.1 Strict</dt>
<dd><code>html:4s</code></dd>
<dt>XHTML 1.0 Transitional</dt>
<dd><code>html:xt</code></dd>
<dt>XHTML 1.0 Strict</dt>
<dd><code>html:xs</code></dd>
<dt>XHTML 1.1</dt>
<dd><code>html:xxs</code></dd>
<dt>HTML 5</dt>
<dd><code>html:5</code></dd>
</dl>
<p>入力例</p>
<p>以下の例では <code>lang</code> 属性が <code>ja</code> になるように ~/vim/ftplugin/html/sparkup.py ファイルを修正している。</p>
<pre>html:5 <span class="Comment">&lt;c-e&gt; を押すと以下のタグが入力される</span>

<span class="Comment">&lt;!DOCTYPE html&gt;</span>
<span class="Identifier">&lt;</span><span class="Statement">html</span><span class="Identifier"> </span><span class="Type">lang</span><span class="Identifier">=</span><span class="Constant">&quot;ja&quot;</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;</span><span class="Statement">head</span><span class="Identifier">&gt;</span>
<span class="PreProc">    </span><span class="Identifier">&lt;</span><span class="Statement">meta</span><span class="Identifier"> </span><span class="Type">charset</span><span class="Identifier">=</span><span class="Constant">&quot;UTF-8&quot;</span><span class="Identifier"> /&gt;</span>
<span class="PreProc">    </span><span class="Identifier">&lt;</span><span class="Statement">title</span><span class="Identifier">&gt;</span><span class="Identifier">&lt;/</span><span class="Statement">title</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;/</span><span class="Statement">head</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;</span><span class="Statement">body</span><span class="Identifier">&gt;</span>

<span class="Identifier">&lt;/</span><span class="Statement">body</span><span class="Identifier">&gt;</span>
<span class="Identifier">&lt;/</span><span class="Statement">html</span><span class="Identifier">&gt;</span>
</pre>
<h3>IE 用条件付きコメント分岐タグ</h3>
<p><code>cc:</code> の後に IE の各バージョンを表わす文字列(<var>type</var>)を記述する。</p>
<p><code>cc:<var>type</var></code></p>
<p>IE の各バージョンとショートカットの一覧</p>
<dl>
<dt>IE （全てのバージョン）</dt>
<dd><code>cc:ie</code></dd>
<dt>IE6 以下</dt>
<dd><code>cc:ie6</code></dd>
<dt>IE7 以下</dt>
<dd><code>cc:ie7</code></dd>
<dt>IE以外</dt>
<dd><code>cc:noie</code></dd>
</dl>
<p>入力例</p>
<pre>cc:ie <span class="Comment">&lt;c-e&gt; を押すと以下のタグが入力される</span>

<span class="Comment">&lt;!</span><span class="Comment">--[if IE]&gt;&lt;![endif]--</span><span class="Comment">&gt;</span>
</pre>
<h3>その他</h3>
<p>その他、入力フォーム・メタタグ・スクリプトタグの入力ショートカットや、入力ショートカットの省略形などが定義されている。<br />
詳細は ~/.vim/ftplugin/html/sparkup.py のコードを参照する。</p>
<p><ins datetime="2010-02-17T20:09:58+0900">追記：コードを参照してショートカットを調べるのが面倒なので vim のヘルプファイルを作りました。<br />
<a href="/resource/sparkup-keys-help.zip">sparkup-keys-help.zip</a></ins></p>
<p><ins datetime="2010-02-22T00:39:27+0900">追記：CSS 用の Zen Coding Vim Script を作りました。<a href="/software/vim-zencodingcss">zencodingcss.vim (Vim Scirpt)</a></ins></p>
<p>参考サイト：<a href="http://github.com/rstacruz/sparkup" class="out">rstacruz&#8217;s sparkup at master &#8211; GitHub</a><br />
　　　　　　<a href="http://www.youtube.com/watch?v=Jw3jipcenKc" class="out">YouTube &#8211; Sparkup with MacVIM</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/4353/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>neocomplcache と暗号化ファイルのキャッシュ</title>
		<link>http://www.serendip.ws/archives/3850</link>
		<comments>http://www.serendip.ws/archives/3850#comments</comments>
		<pubDate>Mon, 14 Dec 2009 03:15:32 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=3850</guid>
		<description><![CDATA[Vim のキーワード補完プラグイン neocomplcache を有効にした状態で暗号化したファイルを扱うと、 ~/.neocon/buffer_cache に一部の文字列がキーワードとして平文で保存されてしまうのでキャ [...]]]></description>
			<content:encoded><![CDATA[<p>Vim のキーワード補完プラグイン <a href="http://github.com/Shougo/neocomplcache" class="out">neocomplcache</a> を有効にした状態で暗号化したファイルを扱うと、 ~/.neocon/buffer_cache に一部の文字列がキーワードとして平文で保存されてしまうのでキャッシュしないように設定する。</p>
<p>.vimrc に記述する <code>g:NeoComplCache_CachingDisablePattern</code> オプションにバッファ名パターンを指定するとよい。<br />
指定する値は正規表現文字列、 <code>\|</code> で区切ると複数のパターンを指定できる。</p>
<pre><span class="Statement">let</span> g:NeoComplCache_CachingDisablePattern <span class="Statement">=</span> <span class="Constant">'\.crypt$\|\.hoge$'</span>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/3850/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>neocomplcache の syntax_cache ファイルの書き込み不可エラー</title>
		<link>http://www.serendip.ws/archives/3629</link>
		<comments>http://www.serendip.ws/archives/3629#comments</comments>
		<pubDate>Fri, 27 Nov 2009 04:23:03 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=3629</guid>
		<description><![CDATA[なんか vim で *.c のファイルを作るたびにキーワード補完プラグインの neocomplcache のエラーが表示されるなと思ったら、 ~/.neocon/syntax_cache/ に作られた c= ファイルの所 [...]]]></description>
			<content:encoded><![CDATA[<p>なんか vim で *.c のファイルを作るたびにキーワード補完プラグインの neocomplcache のエラーが表示されるなと思ったら、 ~/.neocon/syntax_cache/ に作られた c= ファイルの所有者が root になっていて書き込みが出来なかったためだった。</p>
<p>所有者を変更したらエラーは発生しなくなった。</p>
<p>MacPorts のファイルを <code>sudo vi</code> で修正した時に作られたのかな。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/3629/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>neocomplcache.vim で数字キーによるクイックマッチを停止する</title>
		<link>http://www.serendip.ws/archives/3055</link>
		<comments>http://www.serendip.ws/archives/3055#comments</comments>
		<pubDate>Thu, 17 Sep 2009 09:39:43 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=3055</guid>
		<description><![CDATA[キーワード補完 Vim プラグインの neocomplcache で CSS の編集の際に margin や padding などの数値を入力しようとすると数字キーのクイックマッチが働いてしまい使いづらかったので、CSS [...]]]></description>
			<content:encoded><![CDATA[<p>キーワード補完 Vim プラグインの <a href="http://www.vim.org/scripts/script.php?script_id=2620" class="out">neocomplcache</a> で CSS の編集の際に <code>margin</code> や <code>padding</code> などの数値を入力しようとすると数字キーのクイックマッチが働いてしまい使いづらかったので、CSS の編集時のみ数字キーによるクイックマッチを止めさせる設定を行った。</p>
<p>CSS の編集ではクイックマッチをOFFに、その他のファイルの編集ではONにしている。</p>
<pre><span class="Statement">autocmd</span> <span class="Type">BufEnter</span> * <span class="Statement">let</span> g:NeoComplCache_EnableQuickMatch <span class="Statement">=</span> <span class="Constant">1</span>
<span class="Statement">autocmd</span> <span class="Type">BufEnter</span> *.css <span class="Statement">let</span> g:NeoComplCache_EnableQuickMatch <span class="Statement">=</span> <span class="Constant">0</span>
</pre>
<p><ins datetime="2009-09-19T23:13:39+0900">追記：neocomplcache Version 2.77 でクイックマッチの挙動が改良されたので、上記の設定の必要がなくなりました。</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/3055/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MacVim KaoriYa 20090911版 と ATOK2008</title>
		<link>http://www.serendip.ws/archives/3034</link>
		<comments>http://www.serendip.ws/archives/3034#comments</comments>
		<pubDate>Sat, 12 Sep 2009 03:20:54 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=3034</guid>
		<description><![CDATA[MacVim KaoriYa 20090911版がテストリリースされ、日本語変換中にカーソル位置が文字列の先頭に行ってしまう問題が修正されていた。 ところが、日本語変換についてもっと大きな問題を発見した。 ATOK200 [...]]]></description>
			<content:encoded><![CDATA[<p>MacVim KaoriYa <a href="http://blogger.splhack.org/2009/09/macvim-kaoriya-20090911.html" class="out">20090911版</a>がテストリリースされ、日本語変換中にカーソル位置が文字列の先頭に行ってしまう問題が修正されていた。</p>
<p>ところが、日本語変換についてもっと大きな問題を発見した。<br />
ATOK2008で日本語変換する際に、文節に分かれた変換文字列が入れ替わってしまうという問題が発生する。<br />
変換対象のアンダーラインが表示されている状態で、<kbd>Enter</kbd> で確定せずに次の文字を入力すると発生するらしい。</p>
<p>言葉で説明するのが難しいのでスクリーンキャストを撮ってみた。<br />
&quot;新幹線大爆破新幹線大爆破！&quot; となるはずが &quot;新幹線新幹線大爆破新幹線！&quot; となってしまう。</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/PpQArkDINPs&#038;hl=ja&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/PpQArkDINPs&#038;hl=ja&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><ins datetime="2009-10-20T18:16:06+0900">追記：<a href="http://blogger.splhack.org/2009/10/macvim-kaoriya-20091020.html" class="out">20091020版</a> でATOK2008でも問題なく入力できるようになった。<br />
入力に問題のないIMを使っていて、インラインIM入力を有効にするには『環境設定&#8230;』から『詳細』を選び『インラインインプットメソッドを使用する』にチェックをいれる。</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/3034/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MacVim KaoriYa 20090903版 と ATOK2008</title>
		<link>http://www.serendip.ws/archives/2951</link>
		<comments>http://www.serendip.ws/archives/2951#comments</comments>
		<pubDate>Fri, 04 Sep 2009 02:07:10 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=2951</guid>
		<description><![CDATA[MacVim KaoriYa 20090903版がリリースされたので試してみた。 20090902版は Leopard で起動できなかったのが修正されて、問題なく起動できるようになっている。 これまで使っていた 2009 [...]]]></description>
			<content:encoded><![CDATA[<p>MacVim KaoriYa <a href="http://blogger.splhack.org/2009/09/macvim-kaoriya-20090903.html" class="out">20090903版</a>がリリースされたので試してみた。<br />
20090902版は Leopard で起動できなかったのが修正されて、問題なく起動できるようになっている。</p>
<p>これまで使っていた 20090802版では変換中の文字がわずかに上にずれて表示されていたのが、20090903版では変換中の文字も変換確定後の文字と同じ高さに収まっている。<br />
ところが、この処理の副作用なのか、20090903版では変換中の文節のアンダーラインの太さが全て同じ太さになってしまっている。<br />
20090802版では変換中の文字の現在変換処理対象の文字のアンダーラインが少し太く表示される。</p>
<p><img src="http://www.serendip.ws/wordpress/wp-content/uploads/vim20080802_atok2008.png" alt="MacVim KaoriYa 20090802 with ATOK2008" title="MacVim KaoriYa 20090802 with ATOK2008" width="350" height="290" class="size-full wp-image-2953" /></p>
<p><img src="http://www.serendip.ws/wordpress/wp-content/uploads/vim20090903_atok20081.png" alt="MacVim KaoriYa 20090903 with ATOK2008" title="MacVim KaoriYa 20090903 with ATOK2008" width="350" height="290" class="size-full wp-image-2956" /></p>
<p>また、20090903版ではカーソル位置が変換中の文字列の先頭に移動してしまい変換中の文節の位置が分かりにくくなってしまった。</p>
<p>文節の変換候補をカーソルの矢印で選択しようとすると、その<a href="http://blogger.splhack.org/2009/08/macvim-kaoriya-20090823.html" class="out">文節が消えてしまう問題</a>もあった。<br />
ただし、この問題はスペースバーで変換候補を選択する習慣の自分にとってはあまり問題にはならないかも。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/2951/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim で CSS の色をプレビューする Plugin</title>
		<link>http://www.serendip.ws/archives/2607</link>
		<comments>http://www.serendip.ws/archives/2607#comments</comments>
		<pubDate>Sat, 18 Jul 2009 14:03:00 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=2607</guid>
		<description><![CDATA[これまで css や html ファイルを編集中に、カラーコード（例：#ff00ff）を該当する色でハイライト表示する Vim プラグインを使っていたが、うっかり削除してしまった&#8230; もう一度探そうとしても見つ [...]]]></description>
			<content:encoded><![CDATA[<p>これまで css や html ファイルを編集中に、カラーコード（例：<code>#ff00ff</code>）を該当する色でハイライト表示する Vim プラグインを使っていたが、うっかり削除してしまった&#8230;<br />
もう一度探そうとしても見つからず、代わりに見つけたプラグインが <a href="http://www.vim.org/scripts/script.php?script_id=2150" class="out">css_color.vim &#8211; CSS color preview : vim online</a>。</p>
<p>こちらのプラグインでは、カラーコードだけではなく色名（例：<code>white</code>）でもハイライトされる。<br />
さらに256色表示ができるターミナルならば、ターミナル上の Vim でもハイライト表示できる。<br />
ただし、ターミナルでは css、html ファイル編集時に Vim の起動が遅くなってしまった&#8230;</p>
<p>追記：<ins datetime="2009-07-19T18:08:54+0900">ターミナルでの Vim の起動速度の問題は、1つ前のバージョン 0.6 を使えばよい。<br />
ただし、ターミナルでのハイライト表示はできなくなる。</ins></p>
<p><img src="http://www.serendip.ws/wordpress/wp-content/uploads/css_color_vim_ss1.png" alt="gvim でのスクリーンショット" title="gvim でのスクリーンショット" width="320" height="148" class="size-full wp-image-2608" /></p>
<p><img src="http://www.serendip.ws/wordpress/wp-content/uploads/css_color_vim_ss2.png" alt="ターミナルでのスクリーンショット" title="ターミナルでのスクリーンショット" width="319" height="149" class="size-full wp-image-2609" /></p>
<p>このプラグインのインストールは <code>~/.vim/after/syntax/css.vim</code> のようにファイルを配置するだけ。</p>
<p>追記：<ins datetime="2009-11-10T16:01:25+0900"><a href="http://hail2u.net/blog/software/add-support-for-rgb-func-syntax-to-css-color-preview.html" class="out"><code>rgb()</code>/<code>rgba()</code> に対応した CSS color preview</a> もあった。</ins></p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/2607/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>neocomplcache.vim で Omni（オムニ）補完の設定を変える</title>
		<link>http://www.serendip.ws/archives/2598</link>
		<comments>http://www.serendip.ws/archives/2598#comments</comments>
		<pubDate>Thu, 16 Jul 2009 07:36:35 +0000</pubDate>
		<dc:creator>iNo</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.serendip.ws/?p=2598</guid>
		<description><![CDATA[キーワード補完 Vim プラグインの &#34;ネオコン&#34; こと neocomplcache で css を編集している時の Omni（オムニ）補完の補完候補の出るタイミングが自分の好みと合わなかったので（{ [...]]]></description>
			<content:encoded><![CDATA[<p>キーワード補完 Vim プラグインの &quot;ネオコン&quot; こと <a href="http://www.vim.org/scripts/script.php?script_id=2620" class="out">neocomplcache</a> で css を編集している時の Omni（オムニ）補完の補完候補の出るタイミングが自分の好みと合わなかったので（<code>{</code> の直後に補完候補が出てしまい、改行後に <code>}</code> を入力しても移動してくれず、インデントが崩れる。）、設定を変えてみた。</p>
<p>正規表現がテキトーだけど、希望通りの動作になってくれた。</p>
<pre><span class="Statement">if</span> !<span class="Identifier">exists</span><span class="Statement">(</span><span class="Constant">'g:NeoComplCache_OmniPatterns'</span><span class="Statement">)</span>
    <span class="Statement">let</span> g:NeoComplCache_OmniPatterns <span class="Statement">=</span> <span class="Special">{}</span>
<span class="Statement">endif</span>
<span class="Statement">let</span> g:NeoComplCache_OmniPatterns[<span class="Constant">'css'</span>] <span class="Statement">=</span> <span class="Constant">'\v^\s+\w+|\w+[):;]?\s+|[@!]'</span>
</pre>
<p>ネオコン、以前のバージョンよりもキャッシュされるのが速くなってきた。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serendip.ws/archives/2598/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

