Wiki: DebugInfo: TunnelDataInCommands


Detailed view of a page, which is probably more useful for debugging than anything else.

Querying backend directly for 'TunnelDataInCommands'

get_pagedata('TunnelDataInCommands')
 _cached_html 
transformedtext Object
(
    [_type] => pagetype_wikitext Object
        (
        )

    [_basepage] => TunnelDataInCommands
    [_content] => Array
        (
            [0] => <div class="wikitext"><hr />
<h3>The Challenge</h3>
<p class="tightenable top">From 
            [1] => cached_wikilink Object
                (
                    [_page] => SubEthaEdit
                )

            [2] => :
<b>Editing documents in groups can be a challenge. Versioning systems like cvs or subversion can help your group to keep a consistent copy of your document, but don't go that extra mile. Wouldn't it be great to edit the same document, live, in realtime, together with everyone in your group?</b></p>
<blockquote class="tightenable"><p class="tightenable top bottom">
            [3] => cached_externallink Object
                (
                    [_url] => http://www.codingmonkeys.de/subethaedit/screenshots.html
                )

            [4] => </p>
</blockquote>
<p class="tightenable">Another functional working collab editor (cross-platform and mostly free)</p>
<blockquote class="tightenable"><p class="tightenable top bottom">
            [5] => cached_externallink Object
                (
                    [_url] => http://me.sphere.pl/indexen.htm
                )

            [6] => </p>
</blockquote>
<hr />
<p class="tightenable">This topic's parent is 
            [7] => cached_wikilink Object
                (
                    [_page] => HomePage
                )

            [8] =>  but was originally started as a 
            [9] => cached_wikilink Object
                (
                    [_page] => ChallengeIdeas
                )

            [10] => .  This challenge has been updated more than once with partial solutions.  The following description is from :he remote.txt</p>
<blockquote class="tightenable"><p class="tightenable top bottom">When compiled with the |+clientserver| option, Vim can act as a command
server.  It accepts messages from a client and executes them.  At the same
time, Vim can function as a client and send commands to a Vim server.</p>
</blockquote>
<p class="tightenable">The original challenge was to find the best interface to &quot;tunnel data into command mode.&quot;  I feel the real solution is 
            [11] => cached_wikilink Object
                (
                    [_page] => RemoteBuffers
                )

            [12] =>  (see 
            [13] => cached_wikilink Object
                (
                    [_page] => RemoteBufferNotes
                )

            [14] => ), but that doesn't exist in vim yet.  Even once the data transfer problem is resolved, there are other issues that remain unaddressed if the goal is a robust, easy to use implementation.</p>
<ul><li class="tightenable bottom">
            [15] => cached_wikilink Object
                (
                    [_page] => MultiuserSyntaxHighlightTracking
                )

            [16] => </li>
<li class="tightenable top">
            [17] => cached_wikilink Object
                (
                    [_page] => MultiuserAdhocNetworking
                )

            [18] => </li>
</ul>
<hr />
<p class="tightenable">There are two functions that apply for sending data: remote_send() and remote_expr().  The basic functionality explored here is how to get text data from one buffer to another.</p>
<p class="tightenable">Function remote_send() can be invoked directly from within a vim client or via a shell command line.  It acts as if the user were actually typing the keys.  Care must be taken to ensure the correct mode is valid when the keys are sent with remote_send.  Function remote_expr() will evaluate on the remote vimserver and return the results.  To effect a buffer on server GVIM, use commands such as</p>
<blockquote class="tightenable"><p class="tightenable top bottom">:call remote_send( GVIM, '&lt;esc&gt;&lt;esc&gt;:&lt;command&gt;' )</p>
<blockquote class="tightenable top bottom"><p class="tightenable top bottom">or</p>
</blockquote>
<p class="tightenable top bottom">vim --servername GVIM --remote-send '&lt;esc&gt;&lt;esc&gt;:&lt;command&gt;'</p>
</blockquote>
<p class="tightenable">What this challenge presumes is building a &quot;watchdog&quot; kind of application to keep otherwise separate buffers synchronized.  The commands are the most basic ways of moving data from one buffer to another using existing infrastructure.  The advantages and disadvantages of using the X protocols are noted.  The fundamental concept of separate buffers synchronized via some kind of vimscript application (perhaps using patched vim code) remains.</p>
<p class="tightenable">Proof of concept experiments:</p>
<p class="tightenable">The following commands insert an &quot;x&quot; at line 6 col 20 in the local buffer.  The first command uses byte count, the second one uses screen columns.  While no autocommand exists yet for single characters in Insert mode, this might be used in the future.</p>
<blockquote class="tightenable"><p class="tightenable top bottom">:call setline(6,substitute(getline(6),'.\{20}','&amp;x',''))</p>
<blockquote class="tightenable top bottom"><p class="tightenable top bottom">or</p>
</blockquote>
<p class="tightenable top bottom">:let scl = col('.') | let sln = line('.') | let ssrch=@/ | 6s/\%&gt;20v\@=/x/ | call cursor(sln, scl) | let @/   = ssrch</p>
</blockquote>
<p class="tightenable">commands that read one buffer on a client machine and make an initially empty buffer contain the same contents.</p>
<blockquote class="tightenable"><p class="tightenable top bottom">:call remote_send ( &quot;GVIM&quot;, &quot;&lt;esc&gt;&lt;esc&gt;&quot; )<br />
:let b:line = escape ( getline(1) , &quot;'\&quot;&quot;)<br />
:call remote_send(&quot;GVIM&quot;, &quot;:call setline(1, \&quot;&quot; . b:line . &quot;\&quot;)&lt;cr&gt;&quot; )<br />
:let b:loop = 2 + 0<br />
:while (b:loop &lt; line(&quot;$&quot;) + 1)</p>
<blockquote class="tightenable top bottom"><p class="tightenable top bottom">:let b:line = escape ( getline(b:loop) , &quot;'\&quot;&quot;)<br />
:let b:loopminus = b:loop - 1<br />
:call remote_send(&quot;GVIM&quot;, &quot;:call append(&quot; . b:loopminus . &quot;, \&quot;&quot; . b:line . &quot;\&quot;)&lt;cr&gt;&quot; )<br />
:b:loop = b:loop + 1<br /></p>
</blockquote>
<p class="tightenable top bottom">:endwhile</p>
</blockquote>
<p class="tightenable">Future Challenges</p>
<ul><li class="tightenable bottom">implement ways to use these commands automatically, essentially copying the changes from a local buffer editing session and appending them to another buffer in real time, keeping two remote buffers synchronized.  Unfortunatley there is currently no augroup defined for insert-mode character entry though this has been requested for some time.  There are at least two cases: insert mode entry &amp; performing commands.</li>
<li class="tightenable top bottom">Explore the vimdiff implementation for how it might be used for #2.  Keeping one buffer as a &quot;pristine&quot; server copy would allow the diffing of content between the &quot;pristine&quot; buffer and the one in which you are editing.</li>
<li class="tightenable top bottom">turn the above into command(s) that accept a range as input.</li>
<li class="tightenable top">Explore the necessary XFree86 and vim configuration for setting a remote server and remote buffer name once two people desire to collaborate using a common vim buffer.</li>
</ul>
<h3>Related Topics</h3>
<p class="tightenable">
            [19] => cached_wikilink Object
                (
                    [_page] => VimSynchDev
                )

            [20] =>  
            [21] => cached_wikilink Object
                (
                    [_page] => RemoteBufferNotes
                )

            [22] =>  
            [23] => cached_wikilink Object
                (
                    [_page] => MultiuserSyntaxHighlightTracking
                )

            [24] =>  
            [25] => cached_wikilink Object
                (
                    [_page] => MultiuserAdhocNetworking
                )

            [26] =>  
            [27] => cached_wikilink Object
                (
                    [_page] => MultiUserNonVim
                )

            [28] =>  
            [29] => cached_wikilink Object
                (
                    [_page] => SubEthaEdit
                )

            [30] =>  
            [31] => cached_wikilink Object
                (
                    [_page] => ZeroConf
                )

            [32] =>  
            [33] => cached_wikilink Object
                (
                    [_page] => DocSynch
                )

            [34] =>  
            [35] => cached_wikilink Object
                (
                    [_page] => ChallengeIdeas
                )

            [36] => </p>
<h3>References</h3>
<p class="tightenable">A PDF version of a research paper that describes issues that arise when implementing this capability is &quot;Operational Transformation in Real-Time Group Editors: Issues, Algorithms, and Achievements (1998).&quot;</p>
<blockquote class="tightenable"><p class="tightenable top bottom">
            [37] => cached_externallink Object
                (
                    [_url] => http://citeseer.ist.psu.edu/sun98operational.html
                )

            [38] => </p>
</blockquote>
<p class="tightenable">This challenge is inspired by 
            [39] => cached_wikilink Object
                (
                    [_page] => SubEthaEdit
                )

            [40] =>  (many references moved to that page) for the Macintosh Cocoa platform as well as 
            [41] => cached_wikilink Object
                (
                    [_page] => DocSynch
                )

            [42] =>  (see for references) for the 
            [43] => cached_externallink Object
                (
                    [_url] => http://www.jedit.org/
                    [_label] => jEdit
                )

            [44] =>  editor.</p>
<hr />
</div>

        )

    [_description] => From SubEthaEdit: Editing documents in groups can be a challenge. Versioning systems like cvs or subversion can help your group to keep a consistent copy of your document, but don't go that extra mile. Wouldn't it be great to edit the same document, live, in realtime, together with everyone in your group?
)
 hits  5861
get_versiondata('TunnelDataInCommands',82)
 %content  ---- !!The Challenge From SubEthaEdit: < ...
 author  86.144.229.242
 author_id  86.144.229.242
 is_minor_edit   
 markup  2
 mtime  1185211346
 pagetype  wikitext
 summary  Got rid of some off-colour spam
get_versiondata('TunnelDataInCommands',81)
 %content  ---- !!The Challenge From SubEthaEdit: < ...
 _supplanted  1185211346
 author  WikiWord
 author_id  WikiWord
 is_minor_edit   
 markup  2
 mtime  1184002854
 pagetype  wikitext
get_versiondata('TunnelDataInCommands',80)
 %content  ---- !!The Challenge From SubEthaEdit: < ...
 _supplanted  1184002854
 author  WikiWord
 author_id  WikiWord
 is_minor_edit   
 markup  2
 mtime  1183998667
 pagetype  wikitext
get_versiondata('TunnelDataInCommands',79)
 %content  ---- !!The Challenge From SubEthaEdit: < ...
 _supplanted  1183998667
 author  WikiWord
 author_id  WikiWord
 is_minor_edit   
 markup  2
 mtime  1183076352
 pagetype  wikitext
get_versiondata('TunnelDataInCommands',78)
 %content  ---- !!The Challenge From SubEthaEdit: < ...
 _supplanted  1183076352
 author  WikiWord
 author_id  WikiWord
 is_minor_edit   
 markup  2
 mtime  1183075278
 pagetype  wikitext
get_versiondata('TunnelDataInCommands',77)
 %content  ---- !!The Challenge From SubEthaEdit: < ...
 _supplanted  1183075278
 author  MarkStosberg
 author_id  MarkStosberg
 is_minor_edit   
 markup  2
 mtime  1109437464
 pagetype  wikitext
 summary  de-spam

Copyright © 2007 RobertMelton.com