{"id":44872,"date":"2024-10-06T18:49:14","date_gmt":"2024-10-06T10:49:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/44872\/"},"modified":"2024-10-06T18:49:14","modified_gmt":"2024-10-06T10:49:14","slug":"linux-%e5%91%bd%e4%bb%a4%ef%bc%9avi-%e6%96%87%e6%9c%ac%e7%b7%a8%e8%bc%af%e5%99%a8","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/44872\/","title":{"rendered":"Linux \u547d\u4ee4\uff1avi &#8211; \u6587\u672c\u7de8\u8f2f\u5668"},"content":{"rendered":"<h1 id=\"linux-%e5%91%bd%e4%bb%a4%ef%bc%9avi-%e6%96%87%e6%9c%ac%e7%b7%a8%e8%bc%af%e5%99%a8-afJryIkjYu\">Linux \u547d\u4ee4\uff1avi &#8211; \u6587\u672c\u7de8\u8f2f\u5668<\/h1>\n<p>\u5728Linux\u7cfb\u7d71\u4e2d\uff0c\u6587\u672c\u7de8\u8f2f\u5668\u662f\u6bcf\u4f4d\u4f7f\u7528\u8005\u5fc5\u5099\u7684\u5de5\u5177\u4e4b\u4e00\u3002\u7121\u8ad6\u662f\u7de8\u5beb\u4ee3\u78bc\u3001\u7de8\u8f2f\u914d\u7f6e\u6587\u4ef6\uff0c\u9084\u662f\u64b0\u5beb\u6587\u6a94\uff0c\u6587\u672c\u7de8\u8f2f\u5668\u90fd\u626e\u6f14\u8457\u91cd\u8981\u7684\u89d2\u8272\u3002\u5176\u4e2d\uff0c<code>vi<\/code>\u7de8\u8f2f\u5668\u56e0\u5176\u5f37\u5927\u7684\u529f\u80fd\u548c\u9748\u6d3b\u6027\u800c\u5ee3\u53d7\u6b61\u8fce\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e<code>vi<\/code>\u7684\u57fa\u672c\u7528\u6cd5\u53ca\u5176\u7279\u6027\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%afvi%e7%b7%a8%e8%bc%af%e5%99%a8%ef%bc%9f-afJryIkjYu\">\u4ec0\u9ebc\u662fvi\u7de8\u8f2f\u5668\uff1f<\/h2>\n<p><code>vi<\/code>\uff08Visual Editor\u7684\u7e2e\u5beb\uff09\u662f\u4e00\u6b3e\u5728Unix\u548cLinux\u7cfb\u7d71\u4e2d\u5ee3\u6cdb\u4f7f\u7528\u7684\u6587\u672c\u7de8\u8f2f\u5668\u3002\u5b83\u6700\u65e9\u7531Bill Joy\u65bc1976\u5e74\u958b\u767c\uff0c\u81f3\u4eca\u4ecd\u7136\u662f\u8a31\u591aLinux\u767c\u884c\u7248\u7684\u9810\u8a2d\u7de8\u8f2f\u5668\u3002<code>vi<\/code>\u7684\u512a\u52e2\u5728\u65bc\u5176\u8f15\u91cf\u7d1a\u548c\u9ad8\u6548\u6027\uff0c\u7279\u5225\u9069\u5408\u5728\u547d\u4ee4\u884c\u74b0\u5883\u4e2d\u4f7f\u7528\u3002<\/p>\n<h2 id=\"vi%e7%9a%84%e5%9f%ba%e6%9c%ac%e6%93%8d%e4%bd%9c-afJryIkjYu\">vi\u7684\u57fa\u672c\u64cd\u4f5c<\/h2>\n<p>\u4f7f\u7528<code>vi<\/code>\u7de8\u8f2f\u5668\u7684\u57fa\u672c\u6b65\u9a5f\u5982\u4e0b\uff1a<\/p>\n<h3 id=\"%e5%95%9f%e5%8b%95vi%e7%b7%a8%e8%bc%af%e5%99%a8-afJryIkjYu\">\u555f\u52d5vi\u7de8\u8f2f\u5668<\/h3>\n<p>\u8981\u6253\u958b\u4e00\u500b\u6587\u4ef6\uff0c\u53ef\u4ee5\u5728\u7d42\u7aef\u4e2d\u8f38\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>vi filename.txt<\/code><\/pre>\n<p>\u9019\u5c07\u6253\u958b\u540d\u70ba<code>filename.txt<\/code>\u7684\u6587\u4ef6\u3002\u5982\u679c\u8a72\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c<code>vi<\/code>\u5c07\u5275\u5efa\u4e00\u500b\u65b0\u6587\u4ef6\u3002<\/p>\n<h3 id=\"vi%e7%9a%84%e6%a8%a1%e5%bc%8f-afJryIkjYu\">vi\u7684\u6a21\u5f0f<\/h3>\n<p><code>vi<\/code>\u6709\u4e09\u7a2e\u4e3b\u8981\u6a21\u5f0f\uff1a<\/p>\n<ul>\n<li><strong>\u547d\u4ee4\u6a21\u5f0f\uff1a<\/strong>\u9019\u662f<code>vi<\/code>\u7684\u9ed8\u8a8d\u6a21\u5f0f\uff0c\u7528\u65bc\u57f7\u884c\u547d\u4ee4\u3002<\/li>\n<li><strong>\u63d2\u5165\u6a21\u5f0f\uff1a<\/strong>\u5728\u6b64\u6a21\u5f0f\u4e0b\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f38\u5165\u6587\u672c\u3002<\/li>\n<li><strong>\u5e95\u884c\u6a21\u5f0f\uff1a<\/strong>\u7528\u65bc\u57f7\u884c\u7279\u5b9a\u547d\u4ee4\uff0c\u5982\u4fdd\u5b58\u548c\u9000\u51fa\u3002<\/li>\n<\/ul>\n<h3 id=\"%e5%9c%a8vi%e4%b8%ad%e5%88%87%e6%8f%9b%e6%a8%a1%e5%bc%8f-afJryIkjYu\">\u5728vi\u4e2d\u5207\u63db\u6a21\u5f0f<\/h3>\n<p>\u5728\u547d\u4ee4\u6a21\u5f0f\u4e0b\uff0c\u6309\u4e0b<code>i<\/code>\u9375\u53ef\u4ee5\u9032\u5165\u63d2\u5165\u6a21\u5f0f\uff0c\u6309\u4e0b<code>Esc<\/code>\u9375\u53ef\u4ee5\u8fd4\u56de\u547d\u4ee4\u6a21\u5f0f\u3002\u8981\u9032\u5165\u5e95\u884c\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u547d\u4ee4\u6a21\u5f0f\u4e0b\u6309\u4e0b<code>:<\/code>\u9375\u3002<\/p>\n<h3 id=\"%e5%9f%ba%e6%9c%ac%e5%91%bd%e4%bb%a4-afJryIkjYu\">\u57fa\u672c\u547d\u4ee4<\/h3>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684<code>vi<\/code>\u547d\u4ee4\uff1a<\/p>\n<ul>\n<li><code>:w<\/code> &#8211; \u4fdd\u5b58\u6587\u4ef6\u3002<\/li>\n<li><code>:q<\/code> &#8211; \u9000\u51fa\u7de8\u8f2f\u5668\u3002<\/li>\n<li><code>:wq<\/code> &#8211; \u4fdd\u5b58\u4e26\u9000\u51fa\u3002<\/li>\n<li><code>:q!<\/code> &#8211; \u5f37\u5236\u9000\u51fa\uff0c\u4e0d\u4fdd\u5b58\u66f4\u6539\u3002<\/li>\n<li><code>dd<\/code> &#8211; \u522a\u9664\u7576\u524d\u884c\u3002<\/li>\n<li><code>yy<\/code> &#8211; \u8907\u88fd\u7576\u524d\u884c\u3002<\/li>\n<li><code>p<\/code> &#8211; \u7c98\u8cbc\u8907\u88fd\u7684\u5167\u5bb9\u3002<\/li>\n<\/ul>\n<h2 id=\"vi%e7%9a%84%e9%ab%98%e7%b4%9a%e5%8a%9f%e8%83%bd-afJryIkjYu\">vi\u7684\u9ad8\u7d1a\u529f\u80fd<\/h2>\n<p>\u9664\u4e86\u57fa\u672c\u7684\u6587\u672c\u7de8\u8f2f\u529f\u80fd\uff0c<code>vi<\/code>\u9084\u63d0\u4f9b\u4e86\u4e00\u4e9b\u9ad8\u7d1a\u529f\u80fd\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li><strong>\u591a\u6587\u4ef6\u7de8\u8f2f\uff1a<\/strong>\u53ef\u4ee5\u5728<code>vi<\/code>\u4e2d\u540c\u6642\u6253\u958b\u591a\u500b\u6587\u4ef6\uff0c\u4f7f\u7528<code>:n<\/code>\u547d\u4ee4\u5207\u63db\u5230\u4e0b\u4e00\u500b\u6587\u4ef6\u3002<\/li>\n<li><strong>\u67e5\u627e\u548c\u66ff\u63db\uff1a<\/strong>\u4f7f\u7528<code>:\/pattern<\/code>\u67e5\u627e\u6587\u672c\uff0c\u4f7f\u7528<code>:s\/old\/new\/g<\/code>\u9032\u884c\u66ff\u63db\u3002<\/li>\n<li><strong>\u64a4\u92b7\u548c\u91cd\u505a\uff1a<\/strong>\u4f7f\u7528<code>u<\/code>\u64a4\u92b7\u4e0a\u4e00\u6b65\u64cd\u4f5c\uff0c\u4f7f\u7528<code>Ctrl+r<\/code>\u91cd\u505a\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-afJryIkjYu\">\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u7684\u4f86\u8aaa\uff0c<code>vi<\/code>\u662f\u4e00\u6b3e\u529f\u80fd\u5f37\u5927\u4e14\u9748\u6d3b\u7684\u6587\u672c\u7de8\u8f2f\u5668\uff0c\u9069\u5408\u5404\u7a2e\u4f7f\u7528\u5834\u666f\u3002\u7121\u8ad6\u662f\u65b0\u624b\u9084\u662f\u7d93\u9a57\u8c50\u5bcc\u7684\u4f7f\u7528\u8005\uff0c\u90fd\u80fd\u5f9e\u4e2d\u53d7\u76ca\u3002\u638c\u63e1<code>vi<\/code>\u7684\u57fa\u672c\u64cd\u4f5c\u548c\u9ad8\u7d1a\u529f\u80fd\uff0c\u5c07\u6709\u52a9\u65bc\u63d0\u9ad8\u5728Linux\u74b0\u5883\u4e2d\u7684\u5de5\u4f5c\u6548\u7387\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5c0d\u65bc<code>VPS<\/code>\u3001<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u6216\u5176\u4ed6\u76f8\u95dc\u7684<code>\u670d\u52a1\u5668<\/code>\u89e3\u6c7a\u65b9\u6848\u611f\u8208\u8da3\uff0c\u6b61\u8fce\u8a2a\u554f\u6211\u5011\u7684\u7db2\u7ad9\u4ee5\u7372\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a2\u7d22 Linux \u547d\u4ee4 vi\uff0c\u5f37\u5927\u7684\u6587\u672c\u7de8\u8f2f\u5668\uff0c\u5b78\u7fd2\u57fa\u672c\u64cd\u4f5c\u8207\u6280\u5de7\uff0c\u63d0\u5347\u7de8\u8f2f\u6548\u7387\uff0c\u9069\u5408\u65b0\u624b\u8207\u5c08\u696d\u7528\u6236\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-44872","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=44872"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44872\/revisions"}],"predecessor-version":[{"id":44873,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44872\/revisions\/44873"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=44872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=44872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=44872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}