{"id":1423,"date":"2012-02-14T17:07:49","date_gmt":"2012-02-14T09:07:49","guid":{"rendered":"http:\/\/doophp.sinaapp.com\/?p=1423"},"modified":"2012-02-14T17:08:07","modified_gmt":"2012-02-14T09:08:07","slug":"blockwise-string-replase","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/vim\/blockwise-string-replase.html","title":{"rendered":"\u4f7f\u7528VIM\u5757\u64cd\u4f5c\u548c\u66ff\u6362\u64cd\u4f5c\u8fdb\u884c\u591a\u884c\u6ce8\u91ca\u7684\u5e94\u7528"},"content":{"rendered":"


\nVIM\u5757\u64cd\u4f5c<\/strong><\/p>\n

vim\u5217\u5757\u64cd\u4f5c\u5c31\u662f\u5728\u53ef\u662f\u6a21\u5f0f\u4e0b\u64cd\u4f5c\u9009\u62e9\u7684\u884c\u4e2d\u7684\u67d0\u4e00\u4e9b\u5217\u7684\u64cd\u4f5c\uff0c\u6bd4\u5982\u5e38\u89c1\u7684\u6211\u4eec\u9700\u8981\u5728\u5f88\u591a\u884c\u90fd\u9700\u8981\u505a\u4e00\u4e9b\u91cd\u590d\u7684\u5de5\u4f5c\uff0c\u6bd4\u5982\u5728\u884c\u5934\u548c\u884c\u5c3e\u52a0\u76f8\u5e94\u7684\u6807\u7b7e\uff0c\u6216\u8005\u9700\u8981\u5220\u9664\u884c\u4e2d\u95f4\u67d0\u4e00\u4e9b\u7279\u6b8a\u7684\u5217\uff0c\u90a3\u4e48\u5757\u64cd\u4f5c\u5c31\u662f\u5f88\u597d\u7684\u5e2e\u624b\u4e86\u3002<\/p>\n

\u5173\u4e8e\u5217\u5757\u64cd\u4f5c\u7684\u4fe1\u606f\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u8bed\u53e5\u67e5\u770bVIM\u5e2e\u52a9<\/p>\n

:help blockwise-visual<\/p>\n

\u4e00\u822c\u60c5\u51b5\u4e0b\u4f7f\u7528\u5feb\u6377\u952e\u201cCtrl+v\u201d\uff0c\u5757\u64cd\u4f5c\u6a21\u5f0f\u3002\u7279\u522b\u7684\uff0c\u5728gvim(win)\u73af\u5883\u4e0b\u5e94\u8be5\u4f7f\u7528\u201cCtrl+q\u201d\u8fdb\u5165\u5757\u64cd\u4f5c\u6a21\u5f0f\u3002\u8fdb\u5165\u5757\u64cd\u4f5c\u6a21\u5f0f\u540e\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u64cd\u4f5c\u952e<\/p>\n

h\u3001j\u3001k\u3001l\uff1a\u8fdb\u884c\u5757\u9009\u62e9\u5408\u4f5c<\/p>\n

I\uff1a\u8fdb\u884c\u63d2\u5165\u5199\u5165<\/p>\n

A\uff1a\u8fdb\u884c\u8ffd\u52a0\u5199\u5165<\/p>\n

ESC\uff1a\u7f16\u8f91\u5b8c\u5185\u5bb9\u540e\uff0c\u6309\u6b64\u952e\u6267\u884c\u5757\u64cd\u4f5c\u751f\u6548<\/p><\/blockquote>\n

\u9996\u5148\u6309\u201cCtrl+v\u201d\uff08gvim\u201cCtrl+q\u201d\uff09\u8fdb\u5165\u5757\u64cd\u4f5c\u6a21\u5f0f\uff0c\u6309h\/j\/k\/l\u9009\u4e2d\u5757\uff0c\u6309I\u8fdb\u884c\u63d2\u5165\uff0c\u8f93\u5165\u5b8c\u6bd5\u540e\u6309ESC\u952e\u5b8c\u6210\u6ce8\u91ca\u3002<\/p>\n


\n\u66ff\u6362\u64cd\u4f5c<\/strong><\/p>\n

\u4ee5\u4e0b\u662f\u91c7\u7528\u66ff\u6362\u64cd\u4f5c\u8fdb\u884c\u5e38\u89c1\u6ce8\u91ca\u683c\u5f0f\u64cd\u4f5c\u7684\u547d\u4ee4\u6837\u5f0f<\/p>\n

:s\/^\/#\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u7528”#”\u6ce8\u91ca\u5f53\u524d\u884c
\n:2,50s\/^ \/#\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u57282~50\u884c\u9996\u6dfb\u52a0”#”\u6ce8\u91ca
\n:.,+3s\/^\/#\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u7528”#”\u6ce8\u91ca\u5f53\u524d\u884c\u548c\u5f53\u524d\u884c\u540e\u9762\u7684\u4e09\u884c
\n:%s\/^\/#\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u7528”#”\u6ce8\u91ca\u6240\u6709\u884c<\/p><\/blockquote>\n

\u547d\u4ee4\u4e2d\u201c^\u201d\u4ee3\u8868\u5f00\u59cb\uff0c\u4e0e\u6b64\u7c7b\u4f3c\u201c$\u201d\u4ee3\u8868\u7ed3\u675f\uff0c\u6211\u4eec\u540c\u6837\u53ef\u4ee5\u5728\u8bed\u53e5\u7ed3\u5c3e\u6dfb\u52a0\u6ce8\u91ca\u3002
\n\u987a\u4fbf\u590d\u4e60\u4e00\u4e0bvim\u66ff\u6362\u64cd\u4f5c\u547d\u4ee4\uff1a<\/p>\n

:s\/part1\/part2 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u7528part2\u66ff\u6362\u5f53\u524d\u884c\u4e2d\u7b2c1\u4e2apart1
\n:s\/part1 \/part2\/g \u00a0 \u00a0 \u00a0 \u00a0#\u7528part2\u66ff\u6362\u5f53\u524d\u884c\u4e2d\u6240\u6709\u7684part1
\n:%s\/part1\/part2 \u00a0 \u00a0 \u00a0 \u00a0 #\u7528part2\u66ff\u6362\u6240\u6709\u884c\u4e2d\u6bcf\u884c\u7b2c1\u4e2apart1
\n:%s\/part1\/part2\/g \u00a0 \u00a0 \u00a0 #\u7528part2\u66ff\u6362\u6240\u6709\u884c\u4e2d\u6240\u6709\u7684part1
\n:2,50s\/part1 \/part2 \u00a0 \u00a0 \u00a0#\u7528part2\u66ff\u6362\u7b2c2\u884c\u5230\u7b2c50\u884c\u4e2d\u6bcf\u884c\u7b2c1\u4e2apart1
\n:2,50s\/part1\/part2\/g \u00a0 \u00a0#\u7528 part2\u66ff\u6362\u7b2c2\u884c\u5230\u7b2c50\u884c\u4e2d\u6240\u6709\u7684part1
\n:.,+3s\/part1\/part2 \u00a0 \u00a0 \u00a0#\u7528part2\u66ff\u6362\u5f53\u524d\u884c\u4ee5\u53ca\u5f53\u524d\u884c\u540e\u9762\u7684\u4e09\u884c\u4e2d\u6bcf\u884c\u7b2c1\u4e2apart1
\n:.,+3s\/part1\/part2\/g \u00a0 \u00a0#\u7528part2\u66ff\u6362\u5f53\u524d\u884c\u4ee5\u53ca\u5f53\u524d\u884c\u540e\u9762\u7684\u4e09\u884c\u4e2d\u6240\u6709\u7684part1<\/p><\/blockquote>\n


\n\u53c2\u8003\u8d44\u6599\uff1a<\/strong>
\nhttp:\/\/www.21andy.com\/blog\/20100413\/1859.html<\/a>
\n
http:\/\/www.opendocs.net\/vim\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

VIM\u5757\u64cd\u4f5c vim\u5217\u5757\u64cd\u4f5c\u5c31\u662f\u5728\u53ef\u662f\u6a21\u5f0f\u4e0b\u64cd\u4f5c\u9009\u62e9\u7684\u884c\u4e2d\u7684\u67d0\u4e00\u4e9b\u5217\u7684\u64cd\u4f5c\uff0c\u6bd4\u5982\u5e38\u89c1\u7684\u6211\u4eec\u9700\u8981\u5728\u5f88\u591a\u884c\u90fd\u9700\u8981\u505a […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20],"tags":[51],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1423"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1423"}],"version-history":[{"count":6,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1423\/revisions"}],"predecessor-version":[{"id":1429,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1423\/revisions\/1429"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}