<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Peter's Blog - Nodes for vim</title>
    <link>http://www.petersblog.org/</link>
    <description>Nodes containing the tag vim</description>
    <item>
      <title>Never too late to sudo</title>
      <link>http://www.petersblog.org/node/view/1637</link>
      <description>&lt;p&gt;
I found &lt;a href="http://www.vim.org/tips/tip.php?tip_id=975"&gt;the best tip ever&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Scenario: hop into /etc and start editing any file using &lt;a href="/tag/vim"&gt;vim&lt;/a&gt; of course. Go to write the file and find it's read only: bugger forgot to launch vim with &lt;code&gt;sudo vim&lt;/code&gt; or &lt;code&gt;sudoedit&lt;/code&gt;. This happens to me around 50 times a day. 
&lt;/p&gt;
&lt;p&gt;
Solution: 
&lt;/p&gt;
&lt;pre class="lazy"&gt;:w &lt;span class="Keyword"&gt;!&lt;/span&gt;sudo tee %
&lt;/pre&gt;
&lt;p&gt;
I had to go through various man pages to understand this one: 
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;:w !&lt;/b&gt; execute a command, sending it the contents of the current file 
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;sudo&lt;/b&gt; run the command as root. The contents of the file being edited get passed through sudo to the command that sudo launches 
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;tee&lt;/b&gt; the tee command is normally used to allow one to view text that is being pumped to stdout while also saving it to a file. Here it is being used primarily to write from stdin to a named file. &lt;code&gt;cat &gt; %&lt;/code&gt; does not work because the '&gt; %' part is run as the pleb user, not the superuser. 
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;%&lt;/b&gt; vim replaces this with the name of the current file 
&lt;/p&gt;
&lt;p&gt;
It has the downside that the output of tee that is sent to stdout is fed back into vim so vim will wave it at you unless you type in 
&lt;/p&gt;
&lt;pre class="lazy"&gt;:w &lt;span class="Keyword"&gt;!&lt;/span&gt;sudo tee % &lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt; /dev/null
&lt;/pre&gt;
&lt;p&gt;
which is far too much typing. 
&lt;/p&gt;
&lt;p&gt;
vim will also prompt you that the file has changed and do you want to reload it. 
&lt;/p&gt;
&lt;p&gt;
HOWEVER the good thing about this tip is that it is short enough to remember and doesn't need any plugins installed or .vimrc files editing and hence can be used immediately on half a dozen different accounts. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/sudo"&gt;sudo&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1637</guid>
      <category domain="http://www.technorati.com/tag">sudo</category>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
    <item>
      <title>Vim Line Numbers</title>
      <link>http://www.petersblog.org/node/view/1569</link>
      <description>&lt;p&gt;
I've been vimming a lot recently yet I haven't given any vim tips for an eternity. 
&lt;/p&gt;
&lt;p&gt;
With this in .vimrc/_vimrc: 
&lt;/p&gt;
&lt;pre class="lazy"&gt;set numberwidth=5
set numbers
&lt;/pre&gt;
&lt;p&gt;
vim shows line numbers on each line. I've held out against this for years but now I'm using &gt;= 22" widescreen monitors I am converted. 
&lt;/p&gt;
&lt;p&gt;
The only problem is when I am vimming over an ssh tunnel (which I do a lot to maintain &lt;a href="/tag/petersblogger"&gt;PetersBlogger&lt;/a&gt;) and I want to copy and paste: the pasted stuff includes the line numbers. When this crops up I do 
&lt;/p&gt;
&lt;pre class="lazy"&gt;:nonumber
&lt;/pre&gt;
&lt;p&gt;
to turn it off (kinda like doing a :noautoindent before pasting indented code). 
&lt;/p&gt;
&lt;p&gt;
UPDATE: this is even better if the background of the line numbers is changed so you can clearly see the gutter they are in: 
&lt;/p&gt;
&lt;pre class="lazy"&gt;:color murphy
:hi LineNr guifg=white guibg=darkgreen
:hi LineNr ctermfg=white ctermbg=darkgreen
&lt;/pre&gt;
&lt;div style="text-align:center"&gt;&lt;img src="/images/VimLineColor.gif" alt="images/VimLineColor.gif"/&gt;&lt;/div&gt; &lt;p&gt;Related Posts: &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1569</guid>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
    <item>
      <title>Linux Rant </title>
      <link>http://www.petersblog.org/node/view/1265</link>
      <description>&lt;p&gt;
Finally given up with the silly dark-blue on black background text that linux distro's seem so hot on. Life is too short to spend squinting. 
&lt;/p&gt;
&lt;p&gt;
To fix dark blue on black directories from ls: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
edit/create a file called ~/.dir_colors (or copy from /etc/DIR_COLORS or even just edit that). 
&lt;/li&gt;
&lt;li&gt;
change line 
&lt;div class="verbatim-block"&gt;&lt;pre&gt;DIR 01;34       # directory
&lt;/pre&gt;&lt;/div&gt;
to 
&lt;div class="verbatim-block"&gt;&lt;pre&gt;DIR 01;33       # directory
&lt;/pre&gt;&lt;/div&gt;
to make directories yellow. Vim is cool and when you change the numbers it will automatically display them in the corresponding colour. 
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
To fix dark blue on black comments in vim: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
edit/create a file called ~/.vimrc 
&lt;/li&gt;
&lt;li&gt;
add line 
&lt;div class="verbatim-block"&gt;&lt;pre&gt;highlight comment ctermfg=darkgreen
highlight comment guifg=darkgreen
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Related Posts: &lt;a href="/tag/linux"&gt;linux&lt;/a&gt; &lt;a href="/tag/ubuntu"&gt;ubuntu&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1265</guid>
      <category domain="http://www.technorati.com/tag">linux</category>
      <category domain="http://www.technorati.com/tag">ubuntu</category>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
    <item>
      <title>Wing IDE 2.1 beta</title>
      <link>http://www.petersblog.org/node/view/1127</link>
      <description>&lt;p&gt;
&lt;a href="/tag/wingide"&gt;WingIde&lt;/a&gt; 2.1 beta is out and... it has vi keystrokes! &lt;a href="/tag/python"&gt;python&lt;/a&gt; ide, vi keystrokes, it just doesn't get any better. 
&lt;/p&gt;
&lt;p&gt;
Since I have been using Wing IDE I have not looked back. Annoyances: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
Even on a &gt;1Ghz processor it feels sluggish 
&lt;/li&gt;
&lt;li&gt;
It has an indentation analysis thing that examines the indentation in a file. You copy some dubiously indented code from somewhere and paste it into your beautifully crafted code and it decides to reindent your code with tabstop of 8 or something daft. 
&lt;/li&gt;
&lt;li&gt;
ugly gtk user interface 
&lt;/li&gt;
&lt;li&gt;
when editing anything other than python the tab key does nothing and I have to press ctrl-shift-dot to indent. Still, with vi keystrokes &gt;&gt; seems to work. 
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
But for python development, even &lt;a href="/tag/django"&gt;django&lt;/a&gt; and &lt;a href="/tag/turbogears"&gt;turbogears&lt;/a&gt; I wouldn't be without it. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/python"&gt;python&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt; &lt;a href="/tag/wingide"&gt;wingide&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1127</guid>
      <category domain="http://www.technorati.com/tag">python</category>
      <category domain="http://www.technorati.com/tag">vim</category>
      <category domain="http://www.technorati.com/tag">wingide</category>
    </item>
    <item>
      <title>debian update</title>
      <link>http://www.petersblog.org/node/view/1089</link>
      <description>&lt;p&gt;
After a couple of weeks of neglect I ran an update on the packages on my &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; server. It gave me a few surprises: 
&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;
it upgraded mysql from 4.1 to version 5 
&lt;/li&gt;
&lt;li&gt;
it uninstalled the webmin mysql module 
&lt;/li&gt;
&lt;li&gt;
it uninstalled my vim-python version 6.3 and installed plain vim version 6.4 
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;
The new version of mysql seems to be running smoothly (or you wouldn't be reading this). Must see if it supports cascade delete, my all-time favourite sybase sqlanywhere feature. 
&lt;/p&gt;
&lt;p&gt;
I manually installed vim-python using dselect and was happy. Installer glitch. I haven't addressed webmin-mysql yet, it wasn't obvious from what dselect showed me whether what it had would work with mysql 5. Maybe it doesn't say because it doesn't matter? I find webmin-mysql can do all the mysql database administration I need (create database, add users, set permissions, view table etc) with a much simpler interface than phpmyadmin, which is slightly ott. 
&lt;/p&gt;
&lt;p&gt;
I think vim 6.4 is a bug fix release. Upgrading on windows involves recompiling it with python support, not a big deal but it takes time that could be spent doing other things. Sometimes I contemplate hosting vim-python for windows downloads as a public service. I'll contemplate it some more. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/mysql"&gt;mysql&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1089</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">mysql</category>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
    <item>
      <title>Vim with Visual Studio</title>
      <link>http://www.petersblog.org/node/view/1026</link>
      <description>&lt;p&gt;
I'm doing some legacy work using Visual Studio 5 (cannot upgrade as the project uses a library that won't build with anything later: that's third party tools for you). I need a real editor so I've set it up to launch &lt;a href="/tag/vim"&gt;Vim&lt;/a&gt; on the current file when I bang F8. In the tool settings I put: 
&lt;/p&gt;
&lt;p&gt;
Command: 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;C:\Bin\Vim\vim63\gvim.exe
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
Arguments: 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;--remote-silent +$(CurLine) &amp;quot;$(FilePath)&amp;quot;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
The Vim incantation tells it to use an existing vim process if it can find it and tells it to go to the same line in the file as I was at in Visual Studio. 
&lt;/p&gt;
&lt;p&gt;
I could install the vimole thing and have an ole interface but from my recollection it doesn't add much more than the above, which is simple and robust and works with my custom Vim build that includes &lt;a href="/tag/python"&gt;python&lt;/a&gt;. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1026</guid>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
    <item>
      <title>Edit any file with VIM</title>
      <link>http://www.petersblog.org/node/view/1015</link>
      <description>&lt;p&gt;
Kinda exasperated because right-clicking in &lt;a href="/tag/windows"&gt;Windows&lt;/a&gt; file manager or &lt;a href="/tag/salamander"&gt;Salamander&lt;/a&gt; does not give me the option to open &lt;i&gt;any&lt;/i&gt; file in &lt;a href="/tag/vim"&gt;VIM&lt;/a&gt;. For me this has to include .exe's, .dll's, anything that I might want to open: after all, VIM can view binary files in hex mode. 
&lt;/p&gt;
&lt;p&gt;
The VIM setup offers to create something like this but it does not seem to work for me so I've figured out how to hack the registry to do it. A picture is work a 1000 words so: 
&lt;/p&gt;
&lt;div style="text-align:center"&gt;&lt;img src="/images/EditWithVim.gif" alt="images/EditWithVim.gif"/&gt;&lt;/div&gt; 
&lt;p&gt;
This gives a context menu entry saying 'Open with VIM' that opens the selected file in VIM. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/salamander"&gt;salamander&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt; &lt;a href="/tag/windows"&gt;windows&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/1015</guid>
      <category domain="http://www.technorati.com/tag">salamander</category>
      <category domain="http://www.technorati.com/tag">vim</category>
      <category domain="http://www.technorati.com/tag">windows</category>
    </item>
    <item>
      <title>Small Discovery</title>
      <link>http://www.petersblog.org/node/view/915</link>
      <description>&lt;p&gt;
In old dos days I used to use the fc command to do a binary compare on two files. I tried it today at a &lt;a href="taghs/debian"&gt;debian&lt;/a&gt; bash shell and something very odd happened. It opened up &lt;a href="tags/vim"&gt;vim&lt;/a&gt; showing me the last command line I had typed. When I exited vim it then executed that command. 
&lt;/p&gt;
&lt;p&gt;
I had stubled upon something that might be useful, if I can remember it is there next time I want to edit a long command line. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/debian"&gt;debian&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/915</guid>
      <category domain="http://www.technorati.com/tag">debian</category>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
    <item>
      <title>Microblog Progress</title>
      <link>http://www.petersblog.org/node/view/908</link>
      <description>&lt;p&gt;
I am writing this using my &lt;a href="tags/microblog"&gt;Microblog&lt;/a&gt; setup in &lt;a href="tags/vim"&gt;VIM&lt;/a&gt;. This is the first test post. If you can read this then that is a good thing. 
&lt;/p&gt;
&lt;p&gt;
If you can read &lt;i&gt;this&lt;/i&gt; then I can edit as well as post and that is even better. 
&lt;/p&gt;
&lt;p&gt;
I have set things up so that I can edit one of three blogs (Work, peters, personal) by typing (for example): 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;:e blog/Work
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
in vim. 
&lt;/p&gt;
&lt;p&gt;
This will read in all the postings for today where I can edit them or add new ones. I then type: 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;:w
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
to update or publish the posts. This is much easier and quicker than using the &lt;a href="tags/drupal"&gt;drupal&lt;/a&gt; web interface to do anything. 
&lt;/p&gt;
&lt;p&gt;
I can type: 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;:e blog/Work/-1
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
to edit yesterdays posts. 
&lt;/p&gt;
&lt;p&gt;
Hopefully we are seeing the dawn of a new era of more than one post a day. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/microblog"&gt;microblog&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/908</guid>
      <category domain="http://www.technorati.com/tag">microblog</category>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
    <item>
      <title>Create your own file type in VIM</title>
      <link>http://www.petersblog.org/node/view/907</link>
      <description>&lt;p&gt;
This is so cool, I have to tell the world how easy it is. Suppose you want to create a new type of virtual file to edit in &lt;a href="tags/vim"&gt;vim&lt;/a&gt;. You can set vim up to automatically call your handlers to read and write files of your magic file type. Here's how: put this in vimrc or $VIM/plugins/mynewfiletype.vim: 
&lt;/p&gt;
&lt;pre class="lazy"&gt;&lt;span class="line-numbers"&gt;   1 &lt;/span&gt; python &lt;span class="Keyword"&gt;&amp;lt;&amp;lt;&lt;/span&gt; EOF
&lt;span class="line-numbers"&gt;   2 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;   3 &lt;/span&gt; &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="Entity"&gt;WriteFile&lt;/span&gt;( &lt;span class="Variable"&gt;strFile&lt;/span&gt;):
&lt;span class="line-numbers"&gt;   4 &lt;/span&gt;     &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;   5 &lt;/span&gt; &lt;span class="String"&gt;    Write File&lt;/span&gt;
&lt;span class="line-numbers"&gt;   6 &lt;/span&gt; &lt;span class="String"&gt;    &lt;span class="String"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;   7 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;   8 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; Do whatever, send file wherever you like&lt;/span&gt;
&lt;span class="line-numbers"&gt;   9 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  10 &lt;/span&gt;     &lt;span class="Keyword"&gt;pass&lt;/span&gt;
&lt;span class="line-numbers"&gt;  11 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;  12 &lt;/span&gt; &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="Entity"&gt;ReadFile&lt;/span&gt;( &lt;span class="Variable"&gt;strFile&lt;/span&gt;):
&lt;span class="line-numbers"&gt;  13 &lt;/span&gt;     &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  14 &lt;/span&gt; &lt;span class="String"&gt;    Read file&lt;/span&gt;
&lt;span class="line-numbers"&gt;  15 &lt;/span&gt; &lt;span class="String"&gt;    &lt;span class="String"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  16 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  17 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; Do whatever, read file from wherever you like&lt;/span&gt;
&lt;span class="line-numbers"&gt;  18 &lt;/span&gt;     &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  19 &lt;/span&gt;     &lt;span class="Keyword"&gt;pass&lt;/span&gt;
&lt;span class="line-numbers"&gt;  20 &lt;/span&gt; EOF
&lt;span class="line-numbers"&gt;  21 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;  22 &lt;/span&gt; :au BufWriteCmd blog&lt;span class="Keyword"&gt;/&lt;/span&gt;&lt;span class="Keyword"&gt;*&lt;/span&gt; py &lt;span class="MetaFunctionCallPy"&gt;WriteFile&lt;span class="MetaFunctionCallPy"&gt;(&lt;/span&gt;&lt;span class="MetaFunctionCallPy"&gt; &lt;span class="MetaFunctionCallPy"&gt;vim.eval&lt;span class="MetaFunctionCallPy"&gt;(&lt;/span&gt;&lt;span class="MetaFunctionCallPy"&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;expand('&amp;lt;afile&amp;gt;')&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaFunctionCallPy"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaFunctionCallPy"&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  23 &lt;/span&gt; :au BufReadCmd blog&lt;span class="Keyword"&gt;/&lt;/span&gt;&lt;span class="Keyword"&gt;*&lt;/span&gt; py &lt;span class="MetaFunctionCallPy"&gt;ReadFile&lt;span class="MetaFunctionCallPy"&gt;(&lt;/span&gt;&lt;span class="MetaFunctionCallPy"&gt; &lt;span class="MetaFunctionCallPy"&gt;vim.eval&lt;span class="MetaFunctionCallPy"&gt;(&lt;/span&gt;&lt;span class="MetaFunctionCallPy"&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;expand('&amp;lt;afile&amp;gt;')&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaFunctionCallPy"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaFunctionCallPy"&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  24 &lt;/span&gt; 
&lt;/pre&gt;
&lt;p&gt;
In the example above I have said that any file name that starts with 'blog/' is to be handled by my read and write functions instead of being read/written to disk. 
&lt;/p&gt;
&lt;p&gt;
Once this is done: 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;:e blog/blah
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
will cause vim to call the ReadFile function in order to edit the file 'blog/blah' and 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;:w
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
will cause vim to call the WriteFile function to write it. 
&lt;/p&gt;
&lt;p&gt;
ReadFile and WriteFile can do whatever you like: go over networks, send email, climb mountains, send morse code, whatever you can code in python. 
&lt;/p&gt;
&lt;p&gt;
One little word of warning: under windows, the file names get automatically converted to have backslashes, i.e. strFile above will hold &lt;code&gt;blog\\\\blah&lt;/code&gt; instead of &lt;code&gt;blog/blah&lt;/code&gt; even if you type in 
&lt;/p&gt;
&lt;div class="verbatim-block"&gt;&lt;pre&gt;:e blog/blah
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;
to open the file. 
&lt;/p&gt;&lt;p&gt;Related Posts: &lt;a href="/tag/python"&gt;python&lt;/a&gt; &lt;a href="/tag/vim"&gt;vim&lt;/a&gt;&lt;/p&gt;</description>
      <guid>http://www.petersblog.org/node/view/907</guid>
      <category domain="http://www.technorati.com/tag">python</category>
      <category domain="http://www.technorati.com/tag">vim</category>
    </item>
  </channel>
</rss>
