<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Writing a Vim plugin</title>
	<atom:link href="http://items.sjbach.com/97/writing-a-vim-plugin/feed" rel="self" type="application/rss+xml" />
	<link>http://items.sjbach.com/97/writing-a-vim-plugin</link>
	<description></description>
	<lastBuildDate>Fri, 19 Feb 2010 12:11:08 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: duetsch.info : Vim - Ressourcen im Netz</title>
		<link>http://items.sjbach.com/97/writing-a-vim-plugin/comment-page-1#comment-2692</link>
		<dc:creator>duetsch.info : Vim - Ressourcen im Netz</dc:creator>
		<pubDate>Thu, 16 Apr 2009 11:14:52 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=97#comment-2692</guid>
		<description>[...] Writing a Vim plugin [...]</description>
		<content:encoded><![CDATA[<p>[...] Writing a Vim plugin [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Katz</title>
		<link>http://items.sjbach.com/97/writing-a-vim-plugin/comment-page-1#comment-33</link>
		<dc:creator>Adam Katz</dc:creator>
		<pubDate>Fri, 07 Nov 2008 16:43:06 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=97#comment-33</guid>
		<description>That&#039;s a Ukrainian back-reference, translated at http://tinyurl.com/59tjw5 (the above comment says &quot;Again, the editor of all time and peoples, Coming home to Vim and Writing a Vim plugin&quot; ... uh, maybe that&#039;s not a good translation, even if Google and Babelfish agree).</description>
		<content:encoded><![CDATA[<p>That&#8217;s a Ukrainian back-reference, translated at <a href="http://tinyurl.com/59tjw5" rel="nofollow">http://tinyurl.com/59tjw5</a> (the above comment says &#8220;Again, the editor of all time and peoples, Coming home to Vim and Writing a Vim plugin&#8221; &#8230; uh, maybe that&#8217;s not a good translation, even if Google and Babelfish agree).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Weekly linkdump #147 - max - блог разработчиков</title>
		<link>http://items.sjbach.com/97/writing-a-vim-plugin/comment-page-1#comment-15</link>
		<dc:creator>Weekly linkdump #147 - max - блог разработчиков</dc:creator>
		<pubDate>Fri, 17 Oct 2008 09:17:18 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=97#comment-15</guid>
		<description>[...] Снова о редакторе всех времен и народов, Coming home to Vim и Writing a Vim plugin [...]</description>
		<content:encoded><![CDATA[<p>[...] Снова о редакторе всех времен и народов, Coming home to Vim и Writing a Vim plugin [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mb</title>
		<link>http://items.sjbach.com/97/writing-a-vim-plugin/comment-page-1#comment-14</link>
		<dc:creator>mb</dc:creator>
		<pubDate>Wed, 15 Oct 2008 14:50:32 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=97#comment-14</guid>
		<description>It can be done via the above mentioned anonymous
functions inside a Dictionary or a reference to a global
function might be obtained via function.

&lt;pre&gt;
let MyGetpos = function(&quot;getpos&quot;)
let pos = MyGetpos(&quot;.&quot;)
&lt;/pre&gt;

This can also be used to implement object-orientation.

&lt;pre&gt;
function MyClassIncreaseBy(x) dict
    let self.x = self.x + a:x
endfunction

function MyClassNew(init)
    return { &#039;x&#039;: a:init, &#039;increaseBy&#039;: function(&quot;MyClassIncreaseBy&quot;) }
endfunction

let myObj = MyClassNew(3)
&quot; myObj.x == 3
call myObj.increaseBy(2)
&quot; myObj.x == 5
&lt;/pre&gt;

(Examples just for idea, don&#039;t expect sense of content...)

So if you miss object-orientation, you can implement it.
And indeed, there are plugins doing that...</description>
		<content:encoded><![CDATA[<p>It can be done via the above mentioned anonymous<br />
functions inside a Dictionary or a reference to a global<br />
function might be obtained via function.</p>
<pre>
let MyGetpos = function("getpos")
let pos = MyGetpos(".")
</pre>
<p>This can also be used to implement object-orientation.</p>
<pre>
function MyClassIncreaseBy(x) dict
    let self.x = self.x + a:x
endfunction

function MyClassNew(init)
    return { 'x': a:init, 'increaseBy': function("MyClassIncreaseBy") }
endfunction

let myObj = MyClassNew(3)
" myObj.x == 3
call myObj.increaseBy(2)
" myObj.x == 5
</pre>
<p>(Examples just for idea, don&#8217;t expect sense of content&#8230;)</p>
<p>So if you miss object-orientation, you can implement it.<br />
And indeed, there are plugins doing that&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Bach</title>
		<link>http://items.sjbach.com/97/writing-a-vim-plugin/comment-page-1#comment-13</link>
		<dc:creator>Stephen Bach</dc:creator>
		<pubDate>Wed, 15 Oct 2008 13:56:54 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=97#comment-13</guid>
		<description>I am both scared and impressed.  I have to admit I didn&#039;t know that functions could be passed around in Vim Script.</description>
		<content:encoded><![CDATA[<p>I am both scared and impressed.  I have to admit I didn&#8217;t know that functions could be passed around in Vim Script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mb</title>
		<link>http://items.sjbach.com/97/writing-a-vim-plugin/comment-page-1#comment-12</link>
		<dc:creator>mb</dc:creator>
		<pubDate>Wed, 15 Oct 2008 06:17:16 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=97#comment-12</guid>
		<description>The funny thing is: you can have kind of &quot;poor man&#039;s closures&quot; in the latest Vim by means of the Dictionaries.

Eg. something like emacs&#039; &lt;code&gt;save-excursion&lt;/code&gt; becomes possible.

&lt;pre&gt;
function WithSavedPosition(closure)
    let pos = getpos(&quot;.&quot;)
    let r = a:closure.f()
    call setpos(&quot;.&quot;, pos)
    return r
endfunction

function ExtractSomeInfo(firstArg, secondArg)
    let closure = {&#039;a&#039;: a:firstArg, &#039;b&#039;: a:secondArg}

    function closure.f() dict
        call DoMoveAround()
        let x = DoSomethingHereWith(self.a)
        call DoMoreMoving()
        return MoreComputation(x, self.b)
    endfunction

    return WithSavedPosition(closure)
endfunction
&lt;/pre&gt;

Of course these are not real closures, but to allow
this Lisp style programming is actually very nice to
tidy up the environment whenever you need to move,
change a register, etc. etc.

VimScript may be ugly, but it gets the job done.</description>
		<content:encoded><![CDATA[<p>The funny thing is: you can have kind of &#8220;poor man&#8217;s closures&#8221; in the latest Vim by means of the Dictionaries.</p>
<p>Eg. something like emacs&#8217; <code>save-excursion</code> becomes possible.</p>
<pre>
function WithSavedPosition(closure)
    let pos = getpos(".")
    let r = a:closure.f()
    call setpos(".", pos)
    return r
endfunction

function ExtractSomeInfo(firstArg, secondArg)
    let closure = {'a': a:firstArg, 'b': a:secondArg}

    function closure.f() dict
        call DoMoveAround()
        let x = DoSomethingHereWith(self.a)
        call DoMoreMoving()
        return MoreComputation(x, self.b)
    endfunction

    return WithSavedPosition(closure)
endfunction
</pre>
<p>Of course these are not real closures, but to allow<br />
this Lisp style programming is actually very nice to<br />
tidy up the environment whenever you need to move,<br />
change a register, etc. etc.</p>
<p>VimScript may be ugly, but it gets the job done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Bach</title>
		<link>http://items.sjbach.com/97/writing-a-vim-plugin/comment-page-1#comment-11</link>
		<dc:creator>Stephen Bach</dc:creator>
		<pubDate>Tue, 14 Oct 2008 17:35:42 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=97#comment-11</guid>
		<description>Hey, you&#039;re right!  Looks like official Vim binaries since 7.0 include Python.  That really suggests Python as the language of choice if you want to trouble users of your plugin as little as possible.</description>
		<content:encoded><![CDATA[<p>Hey, you&#8217;re right!  Looks like official Vim binaries since 7.0 include Python.  That really suggests Python as the language of choice if you want to trouble users of your plugin as little as possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nf</title>
		<link>http://items.sjbach.com/97/writing-a-vim-plugin/comment-page-1#comment-10</link>
		<dc:creator>nf</dc:creator>
		<pubDate>Tue, 14 Oct 2008 16:29:38 +0000</pubDate>
		<guid isPermaLink="false">http://items.sjbach.com/?p=97#comment-10</guid>
		<description>I believe if you have Python installed on a windows machine and the interpreter in your path that Python scripting from vim works fine.  At least, it&#039;s working for and I&#039;ve never compiled vim on windows.  It&#039;s very convenient to have a sane interpreter at your fingertips at all times.</description>
		<content:encoded><![CDATA[<p>I believe if you have Python installed on a windows machine and the interpreter in your path that Python scripting from vim works fine.  At least, it&#8217;s working for and I&#8217;ve never compiled vim on windows.  It&#8217;s very convenient to have a sane interpreter at your fingertips at all times.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
