<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="http://www.pythonclub.org/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel>
        <title>Python俱乐部</title>
        <description></description>
        <link>http://www.pythonclub.org/</link>
        <lastBuildDate>Mon, 06 Feb 2012 04:59:28 +0800</lastBuildDate>
        <generator>FeedCreator 1.7.2-ppt DokuWiki</generator>
        <image>
            <url>http://www.pythonclub.org/lib/images/favicon.ico</url>
            <title>Python俱乐部</title>
            <link>http://www.pythonclub.org/</link>
        </image>
        <item>
            <title>vimdiff使用技巧</title>
            <link>http://www.pythonclub.org/vim/vimdiff-usage</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot;&gt;&lt;a name=&quot;vimdiff使用技巧&quot; id=&quot;vimdiff使用技巧&quot;&gt;vimdiff使用技巧&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;

源程序文件（通常是纯文本文件）比较和合并工具一直是软件开发过程中比较重要的组成部分。现在市场上很多功能很强大的专用比较和合并工具，比如 &lt;a href=&quot;http://www.pythonclub.org/vim/beyondcompare&quot; class=&quot;wikilink2&quot; title=&quot;vim:beyondcompare&quot; rel=&quot;nofollow&quot;&gt;BeyondCompare&lt;/a&gt;；很多IDE 或者软件配置管理系统，比如Eclipse, Rational &lt;a href=&quot;http://www.pythonclub.org/vim/clearcase&quot; class=&quot;wikilink2&quot; title=&quot;vim:clearcase&quot; rel=&quot;nofollow&quot;&gt;ClearCase&lt;/a&gt;都提供了内建的功能来支持文件的比较和合并。
&lt;/p&gt;

&lt;p&gt;
当远程工作在Unix/Linux平台上的时候，恐怕最简单而且到处存在的就是命令行工具，比如diff。可惜diff的功能有限，使用起来也不是很方便。作为命令行的比较工具，我们仍然希望能拥有简单明了的界面，可以使我们能够对比较结果一目了然；我们还希望能够在比较出来的多处差异之间快速定位，希望能够很容易的进行文件合并……。而Vim提供的diff模式，通常称作vimdiff，就是这样一个能满足所有这些需求，甚至能够提供更多的强力工具。在最近的工作中，因为需要做很多的文件比较和合并的工作，因此对Vimdiff的使用做了一个简单的总结。我们先来看看vimdiff的基本使用。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT1 SECTION &quot;vimdiff使用技巧&quot; [1-1156] --&gt;
&lt;h2 class=&quot;sectionedit2&quot;&gt;&lt;a name=&quot;vimdiff启动方法&quot; id=&quot;vimdiff启动方法&quot;&gt;vimdiff启动方法&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
首先保证系统中的diff命令是可用的。Vim的diff模式是依赖于diff命令的。Vimdiff的基本用法就是：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# vimdiff  FILE_LEFT  FILE_RIGHT&lt;/pre&gt;

&lt;p&gt;
或者

&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# vim -d  FILE_LEFT  FILE_RIGHT&lt;/pre&gt;

&lt;p&gt;
同时gvimdiff是vimdiff的图形界面版本，如果你喜欢gvim的话，可以使用gvimdiff
&lt;/p&gt;

&lt;p&gt;
图一就是vimdiff命令的执行结果的画面。
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.pythonclub.org/_detail/vim/vimdiff-gui.gif?id=vim%3Avimdiff-usage&quot; class=&quot;media&quot; title=&quot;vim:vimdiff-gui.gif&quot;&gt;&lt;img src=&quot;http://www.pythonclub.org/_media/vim/vimdiff-gui.gif&quot; class=&quot;media&quot; title=&quot;vimdiff 使用&quot; alt=&quot;vimdiff 使用&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
从上图我们可以看到一个清晰的比较结果。屏幕被垂直分割，左右两侧分别显示被比较的两个文件。两个文件中连续的相同的行被折叠了起来，以便使用者能把注意力集中在两个文件的差异上。只在某一文件中存在的行的背景色被设置为蓝色，而在另一文件中的对应位置被显示为绿色。两个文件中都存在，但是包含差异的行显示为粉色背景，引起差异的文字用红色背景加以突出。
&lt;/p&gt;

&lt;p&gt;
除了用这种方法启动vim的diff模式之外，我们还可以用分割窗口命令来启动diff模式：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;# vim FILE_LEFT&lt;/pre&gt;

&lt;p&gt;
然后在vim的ex模式（也就是”冒号”模式）下输入：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;:vertical diffsplit FILE_RIGHT&lt;/pre&gt;

&lt;p&gt;
也可以达到同样的效果。如果希望交换两个窗口的位置，或者希望改变窗口的分割方式，可以使用下列命令：

&lt;/p&gt;
&lt;ol&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Ctrl-w K（把当前窗口移到最上边）&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Ctrl-w H（把当前窗口移到最左边）&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Ctrl-w J（把当前窗口移到最下边）&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; Ctrl-w L（把当前窗口移到最右边）&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;

其中1和3两个操作会把窗口改成水平分割方式。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT2 SECTION &quot;vimdiff启动方法&quot; [1157-2783] --&gt;
&lt;h2 class=&quot;sectionedit3&quot;&gt;&lt;a name=&quot;光标移动&quot; id=&quot;光标移动&quot;&gt;光标移动&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
接下来试试在行间移动光标，可以看到左右两侧的屏幕滚动是同步的。这是因为”scrollbind”选项被设置了的结果，vim会尽力保证两侧文件的对齐。如果不想要这个特性，可以设置：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;:set noscrollbind&lt;/pre&gt;

&lt;p&gt;

可以使用快捷键在各个差异点之间快速移动。跳转到下一个差异点：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;]c&lt;/pre&gt;

&lt;p&gt;

反向跳转是：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;[c&lt;/pre&gt;

&lt;p&gt;
如果在命令前加上数字的话，可以跳过一个或数个差异点，从而实现跳的更远。比如如果在位于第一个差异点的行输入”2]c”，将越过下一个差异点，跳转到第三个差异点。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT3 SECTION &quot;光标移动&quot; [2784-3459] --&gt;
&lt;h2 class=&quot;sectionedit4&quot;&gt;&lt;a name=&quot;文件合并&quot; id=&quot;文件合并&quot;&gt;文件合并&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
文件比较的最终目的之一就是合并，以消除差异。如果希望把一个差异点中当前文件的内容复制到另一个文件里，可以使用命令
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;dp （diff &amp;quot;put&amp;quot;）&lt;/pre&gt;

&lt;p&gt;
如果希望把另一个文件的内容复制到当前行中，可以使用命令

&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;do (diff &amp;quot;get&amp;quot;，之所以不用dg，是因为dg已经被另一个命令占用了)&lt;/pre&gt;

&lt;p&gt;
如果希望手工修改某一行，可以使用通常的vim操作。如果希望在两个文件之间来回跳转，可以用下列命令序列：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;Ctrl-w, w&lt;/pre&gt;

&lt;p&gt;
在修改一个或两个文件之后，vimdiff会试图自动来重新比较文件，来实时反映比较结果。但是也会有处理失败的情况，这个时候需要手工来刷新比较结果：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;:diffupdate&lt;/pre&gt;

&lt;p&gt;
如果希望撤销修改，可以和平常用vim编辑一样，直接

&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;&amp;lt;ESC&amp;gt;, u&lt;/pre&gt;

&lt;p&gt;
但是要注意一定要将光标移动到需要撤销修改的文件窗口中。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT4 SECTION &quot;文件合并&quot; [3460-4458] --&gt;
&lt;h2 class=&quot;sectionedit5&quot;&gt;&lt;a name=&quot;同时操作两个文件&quot; id=&quot;同时操作两个文件&quot;&gt;同时操作两个文件&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
在比较和合并告一段落之后，可以用下列命令对两个文件同时进行操作。比如同时退出：

&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;:qa （quit all）&lt;/pre&gt;

&lt;p&gt;
如果希望保存全部文件：

&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;:wa （write all）&lt;/pre&gt;

&lt;p&gt;
或者是两者的合并命令，保存全部文件，然后退出：

&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;:wqa （write, then quit all）&lt;/pre&gt;

&lt;p&gt;
如果在退出的时候不希望保存任何操作的结果：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;:qa! （force to quit all）&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT5 SECTION &quot;同时操作两个文件&quot; [4459-4948] --&gt;
&lt;h2 class=&quot;sectionedit6&quot;&gt;&lt;a name=&quot;上下文的展开和查看&quot; id=&quot;上下文的展开和查看&quot;&gt;上下文的展开和查看&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;p&gt;
比较和合并文件的时候经常需要结合上下文来确定最终要采取的操作。Vimdiff 缺省是会把不同之处上下各 6 行的文本都显示出来以供参考。其他的相同的文本行被自动折叠。如果希望修改缺省的上下文行数，可以这样设置：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;:set diffopt=context:3&lt;/pre&gt;

&lt;p&gt;
可以用简单的折叠命令来临时展开被折叠的相同的文本行：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;zo （folding open，之所以用z这个字母，是因为它看上去比较像折叠着的纸）&lt;/pre&gt;

&lt;p&gt;
然后可以用下列命令来重新折叠：
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;zc （folding close）&lt;/pre&gt;

&lt;p&gt;
下图是设置上下文为3行，并展开了部分相同文本的vimdiff屏幕：
&lt;/p&gt;

&lt;p&gt;
&lt;a href=&quot;http://www.pythonclub.org/_detail/vim/vimdiff-zo.gif?id=vim%3Avimdiff-usage&quot; class=&quot;media&quot; title=&quot;vim:vimdiff-zo.gif&quot;&gt;&lt;img src=&quot;http://www.pythonclub.org/_media/vim/vimdiff-zo.gif&quot; class=&quot;media&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT6 SECTION &quot;上下文的展开和查看&quot; [4949-5716] --&gt;
&lt;h2 class=&quot;sectionedit7&quot;&gt;&lt;a name=&quot;参考&quot; id=&quot;参考&quot;&gt;参考&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.ibm.com/developerworks/cn/linux/l-vimdiff/&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://www.ibm.com/developerworks/cn/linux/l-vimdiff/&quot;  rel=&quot;nofollow&quot;&gt;http://www.ibm.com/developerworks/cn/linux/l-vimdiff/&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT7 SECTION &quot;参考&quot; [5717-] --&gt;</description>
            <author>admin</author>
        <category>vim</category>
            <pubDate>Fri, 03 Feb 2012 15:01:16 +0800</pubDate>
        </item>
        <item>
            <title>Vim 编辑器 - [VIM Tips] </title>
            <link>http://www.pythonclub.org/linux/vim/start</link>
            <description>
&lt;h1 class=&quot;sectionedit8&quot;&gt;&lt;a name=&quot;vim_编辑器&quot; id=&quot;vim_编辑器&quot;&gt;Vim 编辑器&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT8 SECTION &quot;Vim 编辑器&quot; [1-29] --&gt;
&lt;h2 class=&quot;sectionedit9&quot;&gt;&lt;a name=&quot;vim_学习笔记&quot; id=&quot;vim_学习笔记&quot;&gt;Vim 学习笔记&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; VIM学习笔记转载自&lt;a href=&quot;http://yyq123.blogspot.com/p/vim.html&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://yyq123.blogspot.com/p/vim.html&quot;  rel=&quot;nofollow&quot;&gt; 语虚博客&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT9 SECTION &quot;Vim 学习笔记&quot; [30-143] --&gt;
&lt;h3 class=&quot;sectionedit10&quot;&gt;&lt;a name=&quot;vim基础操作&quot; id=&quot;vim基础操作&quot;&gt;VIM基础操作&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/basic-commands&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:basic-commands&quot;&gt;VIM 基本编辑命令&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/move-change&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:move-change&quot;&gt;VIM 移动和修改命令&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/copy-past&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:copy-past&quot;&gt;VIM 中复制和粘帖&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/serach-text&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:serach-text&quot;&gt;VIM 查找文本&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/undo&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:undo&quot;&gt;VIM 中的撤销(Undo)&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT10 SECTION &quot;VIM基础操作&quot; [144-314] --&gt;
&lt;h3 class=&quot;sectionedit11&quot;&gt;&lt;a name=&quot;进阶操作&quot; id=&quot;进阶操作&quot;&gt;进阶操作&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/move-in-words&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:move-in-words&quot;&gt;VIM在单词间移动&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/quick-move&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:quick-move&quot;&gt;VIM 中快速移动&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/scroll-screen&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:scroll-screen&quot;&gt;VIM屏幕滚动&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT11 SECTION &quot;进阶操作&quot; [315-431] --&gt;
&lt;h3 class=&quot;sectionedit12&quot;&gt;&lt;a name=&quot;模式详解&quot; id=&quot;模式详解&quot;&gt;模式详解&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/visual-mode&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:visual-mode&quot;&gt;VIM可视化模式 (Visual Mode)&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT12 SECTION &quot;模式详解&quot; [432-486] --&gt;
&lt;h3 class=&quot;sectionedit13&quot;&gt;&lt;a name=&quot;多文件操作&quot; id=&quot;多文件操作&quot;&gt;多文件操作&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/tabs&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:tabs&quot;&gt;VIM 标签页 (tab)&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/edit-mulit-files&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:edit-mulit-files&quot;&gt;VIM编辑多个文件&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/buffer&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:buffer&quot;&gt;VIM 缓冲区（Buffer）&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/window&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:window&quot;&gt;VIM 窗口(Windows)&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT13 SECTION &quot;多文件操作&quot; [487-622] --&gt;
&lt;h3 class=&quot;sectionedit14&quot;&gt;&lt;a name=&quot;自定义系统&quot; id=&quot;自定义系统&quot;&gt;自定义系统&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/abbreviate&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:abbreviate&quot;&gt;VIM中的缩写&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/map&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:map&quot;&gt;VIM键盘映射 (Map)&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT14 SECTION &quot;自定义系统&quot; [623-699] --&gt;
&lt;h2 class=&quot;sectionedit15&quot;&gt;&lt;a name=&quot;vim_tips&quot; id=&quot;vim_tips&quot;&gt;VIM Tips&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/add-line-no&quot; class=&quot;wikilink1&quot; title=&quot;vim:add-line-no&quot;&gt;有多少种方式可以在vim 中插入行号&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/edit-binary&quot; class=&quot;wikilink1&quot; title=&quot;vim:edit-binary&quot;&gt;用VIM查看编辑二进制文件&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/mouse-select&quot; class=&quot;wikilink1&quot; title=&quot;vim:mouse-select&quot;&gt;VIM 中鼠标选择不选中行号&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/copy-paste&quot; class=&quot;wikilink1&quot; title=&quot;vim:copy-paste&quot;&gt;Vim 复制粘贴探秘&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/encoding&quot; class=&quot;wikilink1&quot; title=&quot;vim:encoding&quot;&gt;vim 编码设置&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/replace&quot; class=&quot;wikilink1&quot; title=&quot;vim:replace&quot;&gt;VIM多行删除，复制，移动&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/map-basic&quot; class=&quot;wikilink1&quot; title=&quot;vim:map-basic&quot;&gt;Vim按键映射&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/non-greedy&quot; class=&quot;wikilink1&quot; title=&quot;vim:non-greedy&quot;&gt;Vim中的非贪婪匹配&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/insert-date&quot; class=&quot;wikilink1&quot; title=&quot;vim:insert-date&quot;&gt;Vim中插入时间&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/vimdiff-usage&quot; class=&quot;wikilink1&quot; title=&quot;vim:vimdiff-usage&quot;&gt;vimdiff使用技巧&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT15 SECTION &quot;VIM Tips&quot; [700-953] --&gt;
&lt;h3 class=&quot;sectionedit16&quot;&gt;&lt;a name=&quot;gvim_相关&quot; id=&quot;gvim_相关&quot;&gt;GVIM 相关&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/vim/gui-font&quot; class=&quot;wikilink1&quot; title=&quot;vim:gui-font&quot;&gt;在Gvim中给中文英文设置不同的字体&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT16 SECTION &quot;GVIM 相关&quot; [954-997] --&gt;
&lt;h2 class=&quot;sectionedit17&quot;&gt;&lt;a name=&quot;vim脚本编程&quot; id=&quot;vim脚本编程&quot;&gt;Vim脚本编程&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/script&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:script&quot;&gt;Vim脚本编写 一、变量、值和表达式&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/gui-mode&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:gui-mode&quot;&gt;判断当前是VIM还是GVIM模式&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT17 SECTION &quot;Vim脚本编程&quot; [998-1079] --&gt;
&lt;h3 class=&quot;sectionedit18&quot;&gt;&lt;a name=&quot;vimrc&quot; id=&quot;vimrc&quot;&gt;vimrc&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/vimrc-example&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:vimrc-example&quot;&gt;史上最强的vimrc文件&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/windows-vimrc&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:windows-vimrc&quot;&gt;Windows vimrc&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT18 SECTION &quot;vimrc&quot; [1080-1160] --&gt;
&lt;h2 class=&quot;sectionedit19&quot;&gt;&lt;a name=&quot;vim_插件&quot; id=&quot;vim_插件&quot;&gt;VIM 插件&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/css-color-preview&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:css-color-preview&quot;&gt;VIM CSS 颜色预览插件&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/pydiction&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:pydiction&quot;&gt;VIM python 自动补全插件：pydiction&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT19 SECTION &quot;VIM 插件&quot; [1161-1249] --&gt;
&lt;h2 class=&quot;sectionedit20&quot;&gt;&lt;a name=&quot;vim_教程&quot; id=&quot;vim_教程&quot;&gt;VIM 教程&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/manual&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:manual&quot;&gt;VIM用户手册7.2中文版&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/efficient-editing&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:efficient-editing&quot;&gt;高效使用vim (Efficient Editing With vim)&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/dajiaxue-vim&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:dajiaxue-vim&quot;&gt;李果正：大家来学VIM&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/linux/vim/magic-vim&quot; class=&quot;wikilink1&quot; title=&quot;linux:vim:magic-vim&quot;&gt;闫石：神奇的VIM&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT20 SECTION &quot;VIM 教程&quot; [1250-] --&gt;</description>
            <author>admin</author>
        <category>linux:vim</category>
            <pubDate>Fri, 03 Feb 2012 14:36:39 +0800</pubDate>
        </item>
        <item>
            <title>Python 无限元素列表</title>
            <link>http://www.pythonclub.org/hacks/infinite-list</link>
            <description>
&lt;h1 class=&quot;sectionedit21&quot;&gt;&lt;a name=&quot;python_无限元素列表&quot; id=&quot;python_无限元素列表&quot;&gt;Python 无限元素列表&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;

今天同学问到Python怎么实现无限元素列表，使用Yield就可以实现无限元素列表。
&lt;/p&gt;

&lt;p&gt;
下面2段代码通过Python Yield 生成器实现了简单的无限元素列表。
&lt;/p&gt;

&lt;/div&gt;
&lt;!-- EDIT21 SECTION &quot;Python 无限元素列表&quot; [1-232] --&gt;
&lt;h2 class=&quot;sectionedit22&quot;&gt;&lt;a name=&quot;递增无限列表&quot; id=&quot;递增无限列表&quot;&gt;递增无限列表&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; increment&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
  i = &lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;True&lt;/span&gt;:
    &lt;span class=&quot;kw1&quot;&gt;yield&lt;/span&gt; i
    i += &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; j &lt;span class=&quot;kw1&quot;&gt;in&lt;/span&gt; increment&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
  &lt;span class=&quot;kw1&quot;&gt;print&lt;/span&gt; i
  &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;j &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; : &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT22 SECTION &quot;递增无限列表&quot; [233-405] --&gt;
&lt;h2 class=&quot;sectionedit23&quot;&gt;&lt;a name=&quot;斐波那契无限列表&quot; id=&quot;斐波那契无限列表&quot;&gt;斐波那契无限列表&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;pre class=&quot;code python&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;def&lt;/span&gt; fibonacci&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
  i = j = &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;
  &lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;True&lt;/span&gt;:
    result, i, j = i, j, i + j
    &lt;span class=&quot;kw1&quot;&gt;yield&lt;/span&gt; result
&amp;nbsp;
&lt;span class=&quot;kw1&quot;&gt;for&lt;/span&gt; k &lt;span class=&quot;kw1&quot;&gt;in&lt;/span&gt; fibonacci&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;:
  &lt;span class=&quot;kw1&quot;&gt;print&lt;/span&gt; k
  &lt;span class=&quot;kw1&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;k &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;100&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; : &lt;span class=&quot;kw1&quot;&gt;break&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;!-- EDIT23 SECTION &quot;斐波那契无限列表&quot; [406-613] --&gt;
&lt;h2 class=&quot;sectionedit24&quot;&gt;&lt;a name=&quot;参考&quot; id=&quot;参考&quot;&gt;参考&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://developer-in-test.blogspot.com/2009/10/infinite-lists-in-python.html&quot; class=&quot;urlextern&quot; target=&quot;_blank&quot; title=&quot;http://developer-in-test.blogspot.com/2009/10/infinite-lists-in-python.html&quot;  rel=&quot;nofollow&quot;&gt;http://developer-in-test.blogspot.com/2009/10/infinite-lists-in-python.html&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT24 SECTION &quot;参考&quot; [614-] --&gt;</description>
            <author>admin</author>
        <category>hacks</category>
            <pubDate>Wed, 01 Feb 2012 22:16:43 +0800</pubDate>
        </item>
        <item>
            <title>Python  技巧 - [List 列表] </title>
            <link>http://www.pythonclub.org/python-hacks/start</link>
            <description>
&lt;h1 class=&quot;sectionedit25&quot;&gt;&lt;a name=&quot;python_技巧&quot; id=&quot;python_技巧&quot;&gt;Python  技巧&lt;/a&gt;&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/python-hacks/function-procedure&quot; class=&quot;wikilink1&quot; title=&quot;python-hacks:function-procedure&quot;&gt;过程式编程与函数式编程&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/python-hacks/re-find&quot; class=&quot;wikilink1&quot; title=&quot;python-hacks:re-find&quot;&gt;得到正则表达式中的特定单元内容&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/python-hacks/perthon&quot; class=&quot;wikilink1&quot; title=&quot;python-hacks:perthon&quot;&gt;Python与Perl脚本转换：perthon&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/hacks/color-decimal&quot; class=&quot;wikilink1&quot; title=&quot;hacks:color-decimal&quot;&gt;将RRGGBB格式的字符串转成十进制R,G,B值&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/hacks/evolution&quot; class=&quot;wikilink1&quot; title=&quot;hacks:evolution&quot;&gt;The Evolution of a Python Programmer&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/hacks/decorator-miaoyong&quot; class=&quot;wikilink1&quot; title=&quot;hacks:decorator-miaoyong&quot;&gt;python装饰器的一个妙用&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/hacks/collection-tips&quot; class=&quot;wikilink1&quot; title=&quot;hacks:collection-tips&quot;&gt;Python Collection 小技巧&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT25 SECTION &quot;Python  技巧&quot; [1-325] --&gt;
&lt;h2 class=&quot;sectionedit26&quot;&gt;&lt;a name=&quot;数据类型数据处理&quot; id=&quot;数据类型数据处理&quot;&gt;数据类型/数据处理&lt;/a&gt;&lt;/h2&gt;
&lt;div class=&quot;level2&quot;&gt;

&lt;/div&gt;
&lt;!-- EDIT26 SECTION &quot;数据类型/数据处理&quot; [326-363] --&gt;
&lt;h3 class=&quot;sectionedit27&quot;&gt;&lt;a name=&quot;变量&quot; id=&quot;变量&quot;&gt;变量&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/python-hacks/variable-defined&quot; class=&quot;wikilink1&quot; title=&quot;python-hacks:variable-defined&quot;&gt;Python中如何判断变量是否已经定义&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT27 SECTION &quot;变量&quot; [364-419] --&gt;
&lt;h3 class=&quot;sectionedit28&quot;&gt;&lt;a name=&quot;list_列表&quot; id=&quot;list_列表&quot;&gt;List 列表&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/hacks/list-element-tongji&quot; class=&quot;wikilink1&quot; title=&quot;hacks:list-element-tongji&quot;&gt;Python统计列表中元素出现的次数&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/hacks/infinite-list&quot; class=&quot;wikilink1&quot; title=&quot;hacks:infinite-list&quot;&gt;Python 无限元素列表&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT28 SECTION &quot;List 列表&quot; [420-504] --&gt;
&lt;h3 class=&quot;sectionedit29&quot;&gt;&lt;a name=&quot;dict_字典&quot; id=&quot;dict_字典&quot;&gt;Dict 字典&lt;/a&gt;&lt;/h3&gt;
&lt;div class=&quot;level3&quot;&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;a href=&quot;http://www.pythonclub.org/python-hacks/string2dict&quot; class=&quot;wikilink1&quot; title=&quot;python-hacks:string2dict&quot;&gt;将字符串类型转为字典类型（string to dict）&lt;/a&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;!-- EDIT29 SECTION &quot;Dict 字典&quot; [505-] --&gt;</description>
            <author>admin</author>
        <category>python-hacks</category>
            <pubDate>Wed, 01 Feb 2012 22:10:09 +0800</pubDate>
        </item>
    </channel>
</rss>

