{"id":2549,"date":"2015-11-26T13:02:32","date_gmt":"2015-11-26T05:02:32","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=2549"},"modified":"2015-11-26T13:02:32","modified_gmt":"2015-11-26T05:02:32","slug":"readvim%e5%ae%9e%e7%94%a8%e6%8a%80%e5%b7%a7","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/2549.html","title":{"rendered":"[read]Vim\u5b9e\u7528\u6280\u5de7"},"content":{"rendered":"<p>=Start=<\/p>\n<p><a href=\"http:\/\/product.dangdang.com\/23459045.html\" target=\"_blank\">\u300aVim\u5b9e\u7528\u6280\u5de7\u300b<\/a>(Pratical Vim)\u8fd9\u672c\u4e66\u7edd\u5bf9\u503c\u5f97\u4e00\u8bfb\uff01\u4e0d\u7ba1\u4f60\u662fVim\u7684\u65b0\u624b\u8fd8\u662fVim\u7684\u719f\u7ec3\u7528\u6237(\u5982\u679c\u662f\u7edd\u9876\u9ad8\u624b\u90a3\u5c31\u7b97\u4e86\u2026\u2026)\u3002<\/p>\n<p>\u5728\u5feb\u901f\u7ffb\u9605\u5b8c\u672c\u4e66\u4e4b\u540e\uff0c\u6211\u7684\u611f\u53d7\u5c31\u50cf\u5728\u8c46\u74e3\u4e0a\u770b\u5230\u7684\u4e00\u5219<a href=\"http:\/\/book.douban.com\/subject\/25869486\/\" target=\"_blank\">\u8bc4\u8bba<\/a>\u300e\u770b\u5b8c\u53d1\u73b0\uff0c\u6211\u4eceVIM\u5165\u95e8\u7ea7\u53d8\u6210\u4e86\u95e8\u5916\u6c49\u7ea7\u3002\u3002\u300f\u3002<\/p>\n<p>\u5176\u5b9e\u6211\u4e4b\u524d\u662f\u4e0d\u503e\u5411\u4e8e\u4e70\u8fd9\u7c7b\u4ecb\u7ecd\u5de5\u5177\u5982\u4f55\u4f7f\u7528\u7684\u4e66\u7684\uff0c\u56e0\u4e3a\u6309\u6211\u4e4b\u524d\u7684\u7ecf\u9a8c\uff0c\u638c\u63e1\u5e38\u7528\u5de5\u517720%\u7684\u7528\u6cd5\u8db3\u4ee5\u5e94\u5bf9\u5de5\u4f5c\u4e2d80%\u7684\u4f7f\u7528\u573a\u666f\uff0c\u6ca1\u5fc5\u8981\u4e13\u95e8\u4e70\u4e00\u672c\u8fd9\u6837\u7684\u4e66\u6765\u770b\uff1b\u800c\u4e14\uff0c\u8fd9\u79cd\u4e66\u901a\u5e38\u4e5f\u4e0d\u4fbf\u5b9c\u3002\u4f46\u5728\u770b\u4e86\u8fd9\u672c\u300aVim\u5b9e\u7528\u6280\u5de7\u300b\u4e4b\u540e\uff0c\u6211\u540e\u6094\u4e86\uff0c\u540e\u6094\u600e\u4e48\u6ca1\u65e9\u70b9\u4e70\u8fd9\u672c\u4e66\u3002\u8fd9\u771f\u7684\u662f\u4e00\u672c\u96be\u5f97\u7684\u597d\u4e66\uff0c\u4e70\u5230\u5c31\u662f\u8d5a\u5230\u3002<\/p>\n<p>\u4e0b\u9762\u8bb0\u5f55\u4e00\u4e0b\u5728\u770b\u672c\u4e66\u7684\u8fc7\u7a0b\u4e2d\u5bf9\u6211\u542f\u53d1\u6bd4\u8f83\u5927\u7684\u5185\u5bb9\uff1a<\/p>\n<hr \/>\n<h5><strong>\u7406\u60f3\u6a21\u5f0f\uff1a\u7528\u4e00\u952e\u79fb\u52a8\uff0c\u53e6\u4e00\u952e\u6267\u884c<\/strong><\/h5>\n<p>\u5728\u6280\u5de7 2 \u4e2d\uff0c\u6211\u4eec\u60f3\u5728\u4e00\u7cfb\u5217\u884c\u7684\u7ed3\u5c3e\u6dfb\u52a0\u5206\u53f7\u3002\u6211\u4eec\u5148\u7528 <code>A;<\/code>&lt;Esc&gt; \u4fee\u6539\u4e86\u7b2c\u4e00\u884c\uff0c\u505a\u5b8c\u8fd9\u6b65\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528 <code>.<\/code> \u547d\u4ee4\u5bf9\u540e\u7eed\u884c\u91cd\u590d\u6b64\u4fee\u6539\u3002\u6211\u4eec\u4f7f\u7528\u4e86 <code>j<\/code> \u547d\u4ee4\u5728\u884c\u95f4\u79fb\u52a8\uff0c\u8981\u5b8c\u6210\u5269\u4f59\u7684\u4fee\u6539\uff0c\u53ea\u9700\u7b80\u5355\u5730\u6309\u8db3\u591f\u591a\u6b21 <code>j.<\/code> \u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<p>\u5728\u6280\u5de7 3 \u4e2d\uff0c\u6211\u4eec\u60f3\u4e3a\u6bcf\u4e2a + \u53f7\u7684\u524d\u540e\u5404\u6dfb\u52a0\u4e00\u4e2a\u7a7a\u683c\u3002\u6211\u4eec\u5148\u7528 <code>f+<\/code> \u547d\u4ee4\u8df3\u5230\u76ee\u6807\u5b57\u7b26\u4e0a\uff0c\u7136\u540e\u7528 <code>s<\/code> \u547d\u4ee4\u628a\u4e00\u4e2a\u5b57\u7b26\u66ff\u6362\u6210 3 \u4e2a\uff0c\u505a\u5b8c\u8fd9\u6b65\u51c6\u5907\u540e\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u6309\u82e5\u5e72\u6b21 <code>;.<\/code> \u5b8c\u6210\u6b64\u4efb\u52a1\u3002<\/p>\n<p>\u5728\u6280\u5de7 5 \u4e2d\uff0c\u6211\u4eec\u60f3\u628a\u6bcf\u5904\u51fa\u73b0\u5355\u8bcd\u201ccontent\u201d\u7684\u5730\u65b9\u90fd\u66ff\u6362\u6210\u201ccopy\u201d\u3002\u6211\u4eec\u4f7f\u7528 * \u547d\u4ee4\u6765\u67e5\u627e\u76ee\u6807\u5355\u8bcd\uff0c\u7136\u540e\u7528 <code>cw<\/code> \u547d\u4ee4\u4fee\u6539\u7b2c\u4e00\u5904\u5730\u65b9\u3002\u505a\u5b8c\u8fd9\u6b65\u51c6\u5907\u540e\uff0c\u5c31\u53ef\u4ee5\u7528 <code>n<\/code> \u952e\u8df3\u5230\u4e0b\u4e00\u5339\u914d\u9879\uff0c\u7136\u540e\u7528 <code>.<\/code> \u952e\u505a\u76f8\u540c\u7684\u4fee\u6539\u3002\u8981\u5b8c\u6210\u8fd9\u9879\u4efb\u52a1\uff0c\u53ea\u9700\u7b80\u5355\u5730\u6309\u8db3\u591f\u591a\u6b21 <code>n.<\/code> \u5c31\u884c\u4e86\u3002<\/p>\n<hr \/>\n<p><strong><span style=\"color: #ff0000;\">cw<\/span><\/strong>replacement&lt;ESC&gt;<\/p>\n<p>$ vim -u NONE -N<br \/>\n:help initialization<\/p>\n<p>:h feature-list<br \/>\n:h +feature-list<\/p>\n<hr \/>\n<p><span style=\"color: #0000ff;\"><strong>\u5728Vim\u7684\u547d\u4ee4\u884c\u4e2d\uff0c\u7b26\u53f7%\u4ee3\u8868\u5f53\u524d\u6587\u4ef6\u540d<\/strong><\/span>\uff08\u53c2\u89c1 :h cmdline-special\uff09\uff0c\u6240\u4ee5\u5982\u679c\u4f60\u6b63\u5728\u5199\u4e00\u4e2a\u7b80\u5355\u7684Python\/Shell\u811a\u672c\u5e76\u4e14\u60f3\u6267\u884c\u770b\u770b\u6548\u679c\u7684\u8bdd\uff0c\u53ef\u4ee5\u5728Vim\u4e2d\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n<p>:!python %<br \/>\n:!bash %<\/p>\n<hr \/>\n<p>\u5728Vim\u4e2d\u64cd\u4f5c\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u65b9\u4fbf\u5730\u8c03\u7528shell\u547d\u4ee4\uff1a<\/p>\n<p>:shell \u542f\u52a8\u4e00\u4e2ashell\uff08\u8f93\u5165exit\u8fd4\u56deVim\uff09<br \/>\n:!{cmd} \u5728shell\u4e2d\u6267\u884c{cmd}<br \/>\n:r !{cmd} \u5728shell\u4e2d\u6267\u884c{cmd}\uff0c\u5e76\u628a\u547d\u4ee4\u7684\u8f93\u51fa\u63d2\u5165\u5230\u5149\u6807\u4e0b\u65b9<br \/>\n:1,3w !{cmd} \u5728shell\u4e2d\u6267\u884c{cmd}\uff0c\u5e76\u4ee5\u5f53\u524d\u6587\u4ef6\u76841-3\u884c\u4f5c\u4e3a{cmd}\u547d\u4ee4\u7684\u8f93\u5165<br \/>\n:1,3 !{filter} \u4f7f\u7528\u5916\u90e8\u7a0b\u5e8f{filter}\u8fc7\u6ee4\u5f53\u524d\u6587\u4ef6\u76841-3\u884c<\/p>\n<hr \/>\n<h6>\u91cd\u590d<\/h6>\n<p>\u4f7f\u7528 . \u547d\u4ee4\u91cd\u590d<strong><span style=\"color: #0000ff;\">\u4e0a\u6b21\u7684\u4fee\u6539<\/span><\/strong>\uff1b<br \/>\n\u4f7f\u7528 @: \u547d\u4ee4\u91cd\u590d<strong><span style=\"color: #0000ff;\">\u4e0a\u6b21\u7684\u5916\u90e8\u547d\u4ee4<\/span><\/strong>\uff1b<br \/>\n\u4f7f\u7528 &amp; \u547d\u4ee4\u91cd\u590d<strong><span style=\"color: #0000ff;\">\u4e0a\u6b21\u7684:substitute\u547d\u4ee4<\/span><\/strong>\uff1b<br \/>\n\u4f7f\u7528 ; \u547d\u4ee4\u91cd\u590d<span style=\"color: #0000ff;\"><strong>\u4e0a\u6b21f\u547d\u4ee4\u6240\u8fdb\u884c\u7684\u67e5\u627e<\/strong><\/span>\u3002<\/p>\n<p>f{char}\u547d\u4ee4\u8ba9Vim\u67e5\u627e\u4e0b\u4e00\u5904\u6307\u5b9a\u5b57\u7b26\u51fa\u73b0\u7684\u4f4d\u7f6e\uff0c&#8217;;&#8217;\u547d\u4ee4\u4f1a\u91cd\u590d\u4e0a\u6b21f\u547d\u4ee4\u6240\u67e5\u627e\u7684\u5b57\u7b26\u3002<\/p>\n<hr \/>\n<p><strong>Vim\u4e2d\u7684\u590d\u5408\u547d\u4ee4\u4ee5\u53ca\u7b49\u6548\u7684\u957f\u547d\u4ee4<\/strong><\/p>\n<table class=\"table table-striped table-condensed\">\n<tbody>\n<tr>\n<td width=\"50%\"><span style=\"color: #ff0000;\"><b>\u590d\u5408\u547d\u4ee4<\/b><\/span><\/td>\n<td width=\"50%\"><b>\u7b49\u6548\u7684\u957f\u547d\u4ee4<\/b><\/td>\n<\/tr>\n<tr>\n<td><code>C<\/code><\/td>\n<td><code>c$<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>s<\/code><\/td>\n<td><code>cl<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>S<\/code><\/td>\n<td><code>^c<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>I<\/code><\/td>\n<td><code>^i<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>A<\/code><\/td>\n<td><code>$a<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>o<\/code><\/td>\n<td><code>A&lt;CR&gt;<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>O<\/code><\/td>\n<td><code>ko<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<p><strong>\u5728\u63d2\u5165\u6a21\u5f0f\u4e2d\u79fb\u52a8\u5149\u6807\u4f1a\u91cd\u7f6e\u4fee\u6539\u72b6\u6001<\/strong>\uff08<strong><span style=\"color: #ff0000;\">\u5f71\u54cd . \u547d\u4ee4<\/span><\/strong>\uff09<\/p>\n<p>\u5982\u679c\u5728\u63d2\u5165\u6a21\u5f0f\u4e2d\u4f7f\u7528\u4e86&lt;Up&gt;\u3001&lt;Down&gt;\u3001&lt;Left&gt;\u6216&lt;Right&gt;\u8fd9\u4e9b\u5149\u6807\u952e\uff0c\u5c06\u4f1a\u4ea7\u751f\u4e00\u4e2a\u65b0\u7684\u64a4\u9500\u5757\u3002\u4f60\u53ef\u4ee5\u628a\u8fd9\u60f3\u8c61\u6210\u5148\u5207\u6362\u4e3a\u666e\u901a\u6a21\u5f0f\uff0c\u7136\u540e\u7528h\/j\/k\/l\u547d\u4ee4\u5bf9\u5149\u6807\u8fdb\u884c\u4e86\u79fb\u52a8\uff0c\u552f\u4e00\u7684\u533a\u522b\u5c31\u662f\uff1a\u6211\u4eec\u5e76\u6ca1\u6709\u9000\u51fa\u63d2\u5165\u6a21\u5f0f\u3002\u8fd9\u65f6\u4e5f\u4f1a\u5bf9 . \u547d\u4ee4\u4ea7\u751f\u5f71\u54cd\u3002<\/p>\n<div class=\"post-text\">\n<hr \/>\n<p><strong>\u53ef\u91cd\u590d\u7684\u64cd\u4f5c\u53ca\u5982\u4f55\u56de\u9000<\/strong><\/p>\n<table class=\"table table-striped table-condensed\">\n<tbody>\n<tr>\n<td width=\"45%\"><b>\u76ee\u7684<\/b><\/td>\n<td width=\"35%\"><b>\u64cd\u4f5c<\/b><\/td>\n<td width=\"10%\"><b>\u91cd\u590d<\/b><\/td>\n<td width=\"10%\"><span style=\"color: #ff0000;\"><b>\u56de\u9000<\/b><\/span><\/td>\n<\/tr>\n<tr>\n<td>\u505a\u51fa\u4e00\u4e2a\u4fee\u6539<\/td>\n<td>{edit}<\/td>\n<td><code>.<\/code><\/td>\n<td><code>u<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u5728\u884c\u5185\u67e5\u627e\u4e0b\u4e00\u6307\u5b9a\u5b57\u7b26<\/td>\n<td><code>f{char}\/t{char}<\/code><\/td>\n<td><code>;<\/code><\/td>\n<td><code>,<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u5728\u884c\u5185\u67e5\u627e\u4e0a\u4e00\u6307\u5b9a\u5b57\u7b26<\/td>\n<td><code>F{char}\/T{char}<\/code><\/td>\n<td><code>;<\/code><\/td>\n<td><code>,<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u5728\u6587\u6863\u4e2d\u67e5\u627e\u4e0b\u4e00\u5904\u5339\u914d\u9879<\/td>\n<td><code>\/pattern&lt;CR&gt;<\/code><\/td>\n<td><code>n<\/code><\/td>\n<td><code>N<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u5728\u6587\u6863\u4e2d\u67e5\u627e\u4e0a\u4e00\u5904\u5339\u914d\u9879<\/td>\n<td><code>?pattern&lt;CR&gt;<\/code><\/td>\n<td><code>n<\/code><\/td>\n<td><code>N<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u6267\u884c\u66ff\u6362<\/td>\n<td>:s\/target\/replacement<\/td>\n<td><code>&amp;<\/code><\/td>\n<td><code>u<\/code><\/td>\n<\/tr>\n<tr>\n<td>\u6267\u884c\u4e00\u7cfb\u5217\u4fee\u6539<\/td>\n<td><code>qx{changes}q<\/code><\/td>\n<td><code>@x<\/code><\/td>\n<td><code>u<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>==<\/p>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"https:\/\/pragprog.com\/titles\/dnvim\/source_code\" target=\"_blank\">https:\/\/pragprog.com\/titles\/dnvim\/source_code<\/a><\/li>\n<li><a href=\"http:\/\/www.ituring.com.cn\/book\/1416\" target=\"_blank\">http:\/\/www.ituring.com.cn\/book\/1416<\/a><\/li>\n<li><a href=\"http:\/\/www.ituring.com.cn\/minibook\/10668\" target=\"_blank\">http:\/\/www.ituring.com.cn\/minibook\/10668<\/a><\/li>\n<li><a href=\"https:\/\/book.douban.com\/subject\/25869486\/\" target=\"_blank\">https:\/\/book.douban.com\/subject\/25869486\/<\/a><\/li>\n<\/ul>\n<h6>\u66f4\u591a\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"http:\/\/easwy.com\/blog\/archives\/practical-vim-chinese-version\/\">http:\/\/easwy.com\/blog\/archives\/practical-vim-chinese-version\/<\/a>\u00a0#\u4e2d\u6587\u8bd1\u8005\u7684blog\uff0c\u540c\u65f6\u5728\u4ed6\u7684blog\u4e2d\u4f60\u53ef\u627e\u5230\u5f88\u591a\u5173\u4e8eVim\u7684\u4f7f\u7528\u6280\u5de7\u7684\u6587\u7ae0<\/li>\n<li><a href=\"https:\/\/www.ibm.com\/developerworks\/cn\/linux\/l-tip-vim1\/\" target=\"_blank\">https:\/\/www.ibm.com\/developerworks\/cn\/linux\/l-tip-vim1\/<\/a><\/li>\n<li><a href=\"http:\/\/wyw.dcweb.cn\/vim\/VimArticle.pdf\" target=\"_blank\">http:\/\/wyw.dcweb.cn\/vim\/VimArticle.pdf<\/a><\/li>\n<li><a href=\"http:\/\/hackll.com\/2015\/04\/12\/20-vim-tips\/\" target=\"_blank\">http:\/\/hackll.com\/2015\/04\/12\/20-vim-tips\/<\/a><\/li>\n<li><a href=\"http:\/\/linux.chinaunix.net\/techdoc\/desktop\/2009\/07\/06\/1122020.shtml\" target=\"_blank\">http:\/\/linux.chinaunix.net\/techdoc\/desktop\/2009\/07\/06\/1122020.shtml<\/a><\/li>\n<li><a href=\"http:\/\/darksun.blog.51cto.com\/3874064\/1548082\" target=\"_blank\">http:\/\/darksun.blog.51cto.com\/3874064\/1548082<\/a><\/li>\n<\/ul>\n<p>=EOF=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u300aVim\u5b9e\u7528\u6280\u5de7\u300b(Pratical Vim)\u8fd9\u672c\u4e66\u7edd\u5bf9\u503c\u5f97\u4e00\u8bfb\uff01\u4e0d\u7ba1\u4f60\u662fVim\u7684\u65b0\u624b\u8fd8\u662fVi [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,12],"tags":[19,43],"class_list":["post-2549","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-tools","tag-tips","tag-vim"],"views":5289,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=2549"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/2549\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=2549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=2549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=2549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}