{"id":208036,"date":"2021-01-03T08:15:33","date_gmt":"2021-01-03T00:15:33","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=208036"},"modified":"2020-12-24T21:16:50","modified_gmt":"2020-12-24T13:16:50","slug":"vi-text-editor","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/vi-text-editor.html","title":{"rendered":"\u4e86\u89e3Vi \u6587\u672c\u7f16\u8f91\u5668"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nVi \u662f\u5178\u578b\u7684 Unix \u6587\u672c\u7f16\u8f91\u5668\u3002\u6765\u4e86\u89e3\u4e00\u4e0b\u5b83\u6216\u5b83\u7684\u5404\u79cd\u5316\u8eab\uff1aVim\u3001Neovim\u3001gVim\u3001nvi \u6216 Elvis\uff0c\u5b83\u9002\u7528\u4e8e Linux\u3001macOS\u3001Windows \u6216 BSD\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"
\n\u4e0d\u7ba1\u4f60\u7528\u7684\u662f Vim\u3001Neovim\u3001gVim\u3001nvi\uff0c\u751a\u81f3\u662f Elvis\uff0c\u5176\u5b9e\u90fd\u662f\u8fd9\u4e2a\u5178\u578b\u7684 Unix \u7f16\u8f91\u5668 Vi\u3002\u53ef\u80fd\u6bcf\u4e00\u4e2a Linux \u548c BSD \u53d1\u884c\u7248\u4e2d\u90fd\u5305\u542b\u4e86 Vi\uff0cVi \u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u7b80\u7ea6\u578b\u6587\u672c\u7f16\u8f91\u5668\uff0c\u7531\u4e8e\u5176\u7b80\u5355\u7b80\u6d01\u7684\u952e\u76d8\u5feb\u6377\u952e\u548c\u53cc\u6a21\u5f0f\u8bbe\u8ba1\uff0c\u5f88\u591a\u7528\u6237\u90fd\u559c\u6b22\u5b83\u3002<\/p>\n

\u6700\u521d\u7684 Vi \u7f16\u8f91\u5668\u662f\u7531 C shell \u7684\u521b\u5efa\u8005 Bill Joy \u7f16\u5199\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u73b0\u4ee3 Vi \u7684\u5316\u8eab\u5df2\u7ecf\u589e\u52a0\u4e86\u8bb8\u591a\u529f\u80fd\uff0c\u5305\u62ec\u591a\u7ea7\u64a4\u9500\u3001\u63d2\u5165\u6a21\u5f0f\u4e0b\u66f4\u597d\u7684\u5bfc\u822a\u3001\u884c\u6298\u53e0\u3001\u8bed\u6cd5\u9ad8\u4eae\u3001\u63d2\u4ef6\u652f\u6301\u7b49\u7b49\u3002Vim \u88ab\u8ba4\u4e3a\u662f\u5b83\u7684\u6700\u6d41\u884c\u7684\u73b0\u4ee3\u5b9e\u73b0\uff0c\u5927\u591a\u6570\u4eba\u5728\u63d0\u5230 Vi \u65f6\u5b9e\u9645\u4e0a\u662f\u6307 Vim\u3002<\/p>\n

\u6240\u6709\u8fd9\u4e9b\u5316\u8eab\u90fd\u662f\u4e3a\u4e86\u540c\u4e00\u4e2a\u76ee\u6807\uff0c\u6240\u4ee5\u672c\u6587\u5c06\u4ece\u901a\u7528\u7684\u573a\u666f\u6765\u63a2\u8ba8 Vi\u3002\u4f60\u7684\u8ba1\u7b97\u673a\u4e0a\u7684\u7248\u672c\u53ef\u80fd\u7565\u6709\u4e0d\u540c\uff0c\u4f46\u4f60\u4ecd\u7136\u53ef\u4ee5\u4ece Vi \u7f16\u8f91\u6587\u672c\u7684\u65b9\u5f0f\u4e2d\u83b7\u76ca\u3002<\/p>\n

\u5b89\u88c5 Vi<\/strong><\/div>\n

\u5982\u679c\u4f60\u8fd0\u884c\u7684\u662f Linux\u3001macOS \u6216 BSD\uff0c\u90a3\u4e48\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86 vi \u547d\u4ee4\u3002\u5982\u679c\u4f60\u5728 Windows \u4e0a\uff0c\u4f60\u53ef\u4ee5\u4e0b\u8f7d Vim \u548c gVim\u3002<\/p>\n

\"\"<\/p>\n

\u5728 NetBSD\u4e0a\uff0cnvi \u662f Vi \u7684\u5e38\u89c1\u66ff\u4ee3\u54c1\uff0c\u800c Slackware \u5219\u63d0\u4f9b\u4e86 Elvis\uff08\u548c Vim\uff09\uff0c\u6d41\u884c\u7684 Neovim \u590d\u523b\u65e8\u5728\u5e2e\u52a9\u7528\u6237\u7528 Lua \u6269\u5c55 Vim\u3002<\/p>\n

\u542f\u52a8 Vi<\/strong><\/div>\n

\u5728\u7ec8\u7aef\u4e2d\u7528 vi \u547d\u4ee4\u542f\u52a8 Vi \u6216 Vim\u3002\u5982\u679c\u5728\u4f60\u7684\u7cfb\u7edf\u4e2d\u6ca1\u6709\u627e\u5230 .vimrc \u6587\u4ef6\uff0c\u90a3\u4e48 Vim \u5c31\u4f1a\u4ee5 Vi \u517c\u5bb9\u6a21\u5f0f\u542f\u52a8\uff08\u4e5f\u53ef\u4ee5\u7528 -C \u9009\u9879\u5f3a\u5236\u542f\u52a8\u8be5\u6a21\u5f0f\uff09\u3002\u5982\u679c\u4f60\u60f3\u4f7f\u7528 gVim \u4ee5\u62e5\u6709\u4e00\u4e2a\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09\uff0c\u4f60\u53ef\u4ee5\u4ece\u684c\u9762\u7684\u5e94\u7528\u7a0b\u5e8f\u83dc\u5355\u4e2d\u542f\u52a8\u5b83\u3002<\/p>\n

\u5982\u679c\u4f60\u662f\u4e00\u4e2a\u521a\u521a\u5b66\u4e60 Vi \u7684\u65b0\u7528\u6237\uff0c\u4f7f\u7528\u56fe\u5f62\u7528\u6237\u754c\u9762\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u5728\u4f60\u53ef\u80fd\u671f\u671b\u7684\u6587\u672c\u7f16\u8f91\u5668\u7684\u884c\u4e3a\u548c Vi \u7684\u8bbe\u8ba1\u884c\u4e3a\u4e4b\u95f4\u63d0\u4f9b\u4e00\u4e2a\u7f13\u51b2\u5e26\u3002\u56fe\u5f62\u7528\u6237\u754c\u9762\u7248\u672c\u6709\u4e00\u4e2a\u83dc\u5355\u680f\uff0c\u4e00\u4e9b\u9f20\u6807\u96c6\u6210\uff0c\u4e00\u4e2a\u5de5\u5177\u680f\u548c\u5176\u4ed6\u529f\u80fd\uff0c\u8fd9\u53ef\u4ee5\u5e2e\u52a9\u4f60\u627e\u5230\u4f60\u53ef\u80fd\u8ba4\u4e3a\u5728\u5178\u578b\u7684\u6587\u672c\u7f16\u8f91\u5668\u4e2d\u7406\u6240\u5f53\u7136\u7684\u57fa\u672c\u529f\u80fd\uff0c\u4f46\u8fd8\u4e0d\u77e5\u9053\u5982\u4f55\u5728 Vi \u4e2d\u505a\u3002<\/p>\n

\u5982\u4f55\u4f7f\u7528 Vi<\/strong><\/div>\n

\u5b66\u4e60 Vi \u6700\u7b80\u5355\u7684\u65b9\u6cd5\u53ef\u80fd\u662f\u4f7f\u7528 vimtutor\uff0c\u8fd9\u662f\u4e00\u4e2a\u4e0e Vim \u6253\u5305\u5728\u4e00\u8d77\u7684\u4ea4\u4e92\u5f0f\u6559\u7a0b\u3002\u8981\u5f00\u59cb\u5b66\u4e60\u8be5\u6559\u7a0b\uff0c\u542f\u52a8 vimtutor \u5e76\u9605\u8bfb\u8bf4\u660e\uff0c\u5c1d\u8bd5\u6bcf\u4e2a\u7ec3\u4e60\u3002\u6b63\u5982\u6559\u7a0b\u4e2d\u6240\u8bf4\uff0c\u5b66\u597d Vi \u4e0d\u662f\u8bb0\u4f4f\u4ec0\u4e48\u952e\u505a\u4ec0\u4e48\uff0c\u800c\u662f\u5efa\u7acb\u808c\u8089\u8bb0\u5fc6\uff0c\u4ee5\u5728\u8f93\u5165\u65f6\u8c03\u7528\u5e38\u7528\u7684\u52a8\u4f5c\u3002<\/p>\n

Esc \u952e<\/strong><\/div>\n

\u5b66\u4e60 Vi \u7684\u7b2c\u4e00\u4ef6\u91cd\u8981\u7684\u4e8b\u5c31\u662f\u638c\u63e1 Esc \u952e\u3002Esc \u662f\u6fc0\u6d3b\u547d\u4ee4\u6a21\u5f0f\u7684\u5de5\u5177\uff0c\u5f88\u5feb\u4f60\u5c31\u4f1a\u660e\u767d\uff0c\u5728 Vi \u4e2d\uff0c\u53ea\u8981\u4f60\u4e0d\u786e\u5b9a\uff0c\u5c31\u6309 Esc\u3002\u5728\u547d\u4ee4\u6a21\u5f0f\u4e0b\uff0c\u4f60\u6309\u4e0b\u7684\u4efb\u4f55\u952e\u90fd\u4e0d\u4f1a\u88ab\u8f93\u5165\u5230\u4f60\u6b63\u5728\u5904\u7406\u7684\u6587\u672c\u6587\u6863\u4e2d\uff0c\u800c\u662f\u88ab Vi \u89e3\u91ca\u4e3a\u4e00\u6761\u547d\u4ee4\u3002\u4f8b\u5982\uff0c\u8981\u5c06\u5149\u6807\u5411\u5de6\u79fb\u52a8\uff0c\u4f60\u53ef\u4ee5\u6309\u952e\u76d8\u4e0a\u7684 H \u952e\u3002\u5982\u679c\u4f60\u5904\u4e8e\u63d2\u5165\u6a21\u5f0f\uff0c\u90a3\u4e48\u6309 H \u952e\u5c31\u4f1a\u8f93\u5165\u5b57\u6bcd H\uff0c\u5c31\u50cf\u4f60\u671f\u671b\u7684\u90a3\u6837\u3002\u4f46\u5728\u547d\u4ee4\u6a21\u5f0f\u4e0b\uff0c\u6309 H \u5411\u5de6\u79fb\u52a8\uff0cL \u5411\u53f3\u79fb\u52a8\uff0cJ \u5411\u4e0b\u79fb\u52a8\uff0cK \u5411\u4e0a\u79fb\u52a8\u3002<\/p>\n

\u547d\u4ee4\u6a21\u5f0f\u548c\u63d2\u5165\u6a21\u5f0f\u7684\u5206\u79bb\u4e0e\u5176\u4ed6\u6587\u672c\u7f16\u8f91\u5668\u7684\u5de5\u4f5c\u65b9\u5f0f\u5f62\u6210\u4e86\u9c9c\u660e\u7684\u5bf9\u6bd4\uff0c\u7531\u4e8e\u8fd9\u79cd\u8bbe\u8ba1\uff0c\u8fd9\u53ef\u80fd\u662f Vi \u6700\u663e\u8457\u7684\u5dee\u5f02\u5316\u3002\u4e0d\u8fc7\u6709\u8da3\u7684\u662f\uff0c\u7406\u8bba\u4e0a\u6765\u8bf4\uff0c\u5b83\u4e0e\u4f60\u53ef\u80fd\u5df2\u6709\u7684\u5de5\u4f5c\u65b9\u5f0f\u5e76\u6ca1\u6709\u592a\u5927\u7684\u533a\u522b\u3002\u6bd5\u7adf\uff0c\u5f53\u4f60\u628a\u624b\u4ece\u952e\u76d8\u4e0a\u62ff\u5f00\uff0c\u7528\u9f20\u6807\u9009\u62e9\u6587\u672c\u65f6\uff0c\u4f60\u57fa\u672c\u4e0a\u662f\u5c06\u81ea\u5df1\u7f6e\u4e8e\u4e00\u79cd\u547d\u4ee4\u6a21\u5f0f\u4e2d\u3002\u5728 Vi \u4e2d\uff0c\u4f60\u4e0d\u9700\u8981\u628a\u624b\u4ece\u952e\u76d8\u4e0a\u79fb\u5f00\u6765\u79fb\u52a8\u9f20\u6807\uff0c\u4e5f\u4e0d\u9700\u8981\u6309\u529f\u80fd\u952e\u6216 Ctrl \u952e\uff0c\u800c\u662f\u5c06\u7f16\u8f91\u5668\u653e\u5165\u4e00\u79cd\u7279\u6b8a\u7684\u64cd\u4f5c\u6a21\u5f0f\u4e2d\uff0c\u4f7f\u4f60\u7684\u6309\u952e\u91cd\u65b0\u5206\u914d\u5230\u547d\u4ee4\u4e0a\uff0c\u800c\u4e0d\u662f\u6587\u5b57\u8f93\u5165\u3002<\/p>\n

\u6269\u5c55 Vi<\/strong><\/div>\n

\u5728 Vim 8.0 \u7248\u672c\u4e4b\u524d\uff0cVi \u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u201c\u53ea\u662f\u201d\u4e00\u4e2a\u6587\u672c\u7f16\u8f91\u5668\u3002\u5b83\u6709\u63d2\u4ef6\uff0c\u4f46\u5b89\u88c5\u63d2\u4ef6\u662f\u4e00\u4e2a\u624b\u52a8\u7684\u8fc7\u7a0b\uff0c\u5f88\u591a\u7528\u6237\u4ece\u672a\u60f3\u8fc7\u8981\u8fd9\u4e48\u505a\u3002\u5e78\u8fd0\u7684\u662f\uff0cVim 8 \u53ca\u4ee5\u4e0a\u7248\u672c\u63d0\u4f9b\u4e86\u5bf9\u63d2\u4ef6\u7ba1\u7406\u7684\u652f\u6301\uff0c\u4f7f\u5f97\u5b89\u88c5\u548c\u52a0\u8f7d\u63d2\u4ef6\u53d8\u5f97\u8f7b\u800c\u6613\u4e3e\u3002<\/p>\n

\u5b89\u88c5 Vim \u7684\u63d2\u4ef6\u53ef\u4ee5\u901a\u8fc7 vim-plug \u529f\u80fd\u6765\u5b8c\u6210\u3002\u4f8b\u5982\uff0c\u8981\u5b89\u88c5 Vi \u6587\u4ef6\u6d4f\u89c8\u5668 NERDTree\uff1a<\/p>\n

\r\n:PlugInstall NERDTree\r\n<\/pre>\n

\u4f60\u4e5f\u53ef\u4ee5\u66f4\u65b0\u63d2\u4ef6\uff1a<\/p>\n

\r\n:PlugUpdate NERDTree\r\n<\/pre>\n

\u5173\u4e8e\u4f7f\u7528 vim-plug \u548c\u624b\u52a8\u5b89\u88c5\u63d2\u4ef6\u548c\u4e3b\u9898\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u9605\u8bfb\u6211\u7684\u6587\u7ae0\u300a\u5982\u4f55\u5b89\u88c5 Vim \u63d2\u4ef6\u300b\u3002<\/p>\n

\u9ed8\u8ba4 Vi<\/strong><\/div>\n

Vi \u4e0d\u4ec5\u4ec5\u6d41\u884c\uff0c\u5b83\u8fd8\u662f\u4e00\u4e2a POSIX \u6807\u51c6\u3002\u5b83\u662f\u6bcf\u4e2a\u7cfb\u7edf\u7ba1\u7406\u5458\u90fd\u5e94\u8be5\u77e5\u9053\u5982\u4f55\u4f7f\u7528\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u5373\u4f7f\u4ed6\u4eec\u4e0d\u6253\u7b97\u6bcf\u5929\u4f7f\u7528\u5b83\u3002\u5b83\u4e5f\u662f\u4e00\u4e2a\u5feb\u901f\u800c\u7b80\u5355\u7684\u7f16\u8f91\u5668\uff0c\u6240\u4ee5\u4e00\u65e6\u4f60\u719f\u7ec3\u638c\u63e1\u4e86\u5b83\uff0c\u5b83\u53ef\u80fd\u5c31\u662f\u4f60\u4e00\u76f4\u5728\u5bfb\u627e\u7684\u7f16\u8f91\u5668\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e0d\u7ba1\u4f60\u7528\u7684\u662f Vim\u3001Neovim\u3001gVim\u3001nvi\uff0c\u751a\u81f3\u662f Elvis\uff0c\u5176\u5b9e\u90fd\u662f\u8fd9\u4e2a\u5178\u578b\u7684 Unix \u7f16\u8f91\u5668 […]<\/p>\n","protected":false},"author":362,"featured_media":208041,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-208036","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/208036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/362"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=208036"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/208036\/revisions"}],"predecessor-version":[{"id":208081,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/208036\/revisions\/208081"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/208041"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=208036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=208036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=208036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}