{"id":35095,"date":"2023-01-07T09:08:02","date_gmt":"2023-01-07T01:08:02","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=35095"},"modified":"2023-01-07T09:08:37","modified_gmt":"2023-01-07T01:08:37","slug":"how-setup-vi","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/how-setup-vi.html","title":{"rendered":"\u5982\u4f55\u5b89\u88c5\u548c\u4f7f\u7528\u7eaf\u6587\u672c\u7f16\u8f91\u5668 vi\/vim"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u51e0\u4e2a\u6708\u524d\uff0c Linux \u57fa\u91d1\u4f1a\u53d1\u8d77\u4e86 LFCS \uff08Linux \u57fa\u91d1\u4f1a\u8ba4\u8bc1\u7cfb\u7edf\u7ba1\u7406\u5458Linux Foundation Certified System administrator\uff09\u8ba4\u8bc1\uff0c\u4ee5\u5e2e\u52a9\u4e16\u754c\u5404\u5730\u7684\u4eba\u6765\u9a8c\u8bc1\u4ed6\u4eec\u80fd\u591f\u5728 Linux \u7cfb\u7edf\u4e0a\u505a\u57fa\u672c\u7684\u4e2d\u7ea7\u7cfb\u7edf\u7ba1\u7406\u4efb\u52a1\uff1a\u5982\u7cfb\u7edf\u652f\u6301\u3001\u7b2c\u4e00\u624b\u7684\u6545\u969c\u8bca\u65ad\u548c\u5904\u7406\u3001\u4ee5\u53ca\u4f55\u65f6\u5411\u4e0a\u6e38\u652f\u6301\u56e2\u961f\u63d0\u51fa\u95ee\u9898\u7684\u667a\u80fd\u51b3\u7b56\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"preparation-for-lfcs201\"<\/p>\n

\u8fd9\u7bc7\u6587\u7ae0\u662f\u7cfb\u5217\u6559\u7a0b\u7684\u7b2c\u4e8c\u8bb2\uff0c\u5728\u8fd9\u4e2a\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u4f1a\u4ecb\u7ecd vi\/vim \u57fa\u672c\u7684\u6587\u4ef6\u7f16\u8f91\u64cd\u4f5c\uff0c\u5e2e\u52a9\u8bfb\u8005\u7406\u89e3\u7f16\u8f91\u5668\u4e2d\u7684\u4e09\u4e2a\u6a21\u5f0f\uff0c\u8fd9\u662f LFCS \u8ba4\u8bc1\u8003\u8bd5\u4e2d\u5fc5\u987b\u638c\u63e1\u7684<\/p>\n

\u4f7f\u7528 vi\/vim \u6267\u884c\u57fa\u672c\u7684\u6587\u4ef6\u7f16\u8f91\u64cd\u4f5c<\/strong><\/div>\n

vi \u662f\u4e3a Unix \u800c\u751f\u7684\u7b2c\u4e00\u4e2a\u5168\u5c4f\u6587\u672c\u7f16\u8f91\u5668\u3002\u5b83\u7684\u8bbe\u8ba1\u5c0f\u5de7\u7b80\u5355\uff0c\u5bf9\u4e8e\u4ec5\u4ec5\u4f7f\u7528\u8fc7\u8bf8\u5982 NotePad++ \u6216 gedit \u7b49\u56fe\u5f62\u754c\u9762\u7684\u6587\u672c\u7f16\u8f91\u5668\u7684\u7528\u6237\u6765\u8bf4\uff0c\u4f7f\u7528\u8d77\u6765\u53ef\u80fd\u5b58\u5728\u4e00\u4e9b\u56f0\u96be\u3002<\/p>\n

\u4e3a\u4e86\u4f7f\u7528 vi\uff0c\u6211\u4eec\u5fc5\u987b\u9996\u5148\u7406\u89e3\u8fd9\u4e2a\u5f3a\u5927\u7684\u7a0b\u5e8f\u64cd\u4f5c\u4e2d\u7684\u4e09\u79cd\u6a21\u5f0f\uff0c\u65b9\u4fbf\u6211\u4eec\u540e\u8fb9\u5b66\u4e60\u8fd9\u4e2a\u5f3a\u5927\u7684\u6587\u672c\u5904\u7406\u8f6f\u4ef6\u7684\u76f8\u5173\u64cd\u4f5c\u3002<\/p>\n

\u8bf7\u6ce8\u610f\uff0c\u5927\u591a\u6570\u7684\u73b0\u4ee3 Linux \u53d1\u884c\u7248\u90fd\u96c6\u6210\u4e86 vi \u7684\u53d8\u79cd\u2014\u2014\u2014 vim\uff08\u6539\u8fdb\u7248 VIVi IMproved\uff09\uff0c\u76f8\u6bd4\u4e8e vi\uff0c\u5b83\u6709\u66f4\u591a\u65b0\u529f\u80fd\u3002\u6240\u4ee5\uff0c\u6211\u4eec\u4f1a\u5728\u672c\u6559\u7a0b\u4e2d\u4ea4\u66ff\u4f7f\u7528 vi \u548c vim\u3002<\/p>\n

\u5982\u679c\u4f60\u7684\u53d1\u884c\u7248\u8fd8\u6ca1\u6709\u5b89\u88c5 vim\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u6765\u5b89\u88c5\uff1a<\/p>\n

    \n
  • \u2022Ubuntu \u53ca\u5176\u884d\u751f\u7248\uff1aapt-get update && apt-get install vim<\/li>\n
  • \u2022\u4ee5 Red-Hat \u4e3a\u57fa\u7840\u7684\u53d1\u884c\u7248\uff1ayum update && yum install vim<\/li>\n
  • \u2022openSUSE \uff1azypper update && zypper install vim<\/li>\n<\/ul>\n
    \u6211\u4e3a\u4ec0\u4e48\u8981\u5b66\u4e60 vi<\/strong><\/div>\n

    \u81f3\u5c11\u6709\u4ee5\u4e0b\u4e24\u4e2a\u7406\u7531\uff1a<\/p>\n

      \n
    1. \u56e0\u4e3a\u5b83\u662f POSIX \u6807\u51c6\u7684\u4e00\u90e8\u5206\uff0c\u6240\u4ee5\u4e0d\u7ba1\u4f60\u4f7f\u7528\u4ec0\u4e48\u53d1\u884c\u7248 vi \u603b\u662f\u53ef\u7528\u7684\u3002<\/li>\n
    2. vi \u57fa\u672c\u4e0d\u6d88\u8017\u591a\u5c11\u7cfb\u7edf\u8d44\u6e90\uff0c\u5e76\u4e14\u5141\u8bb8\u6211\u4eec\u4ec5\u4ec5\u901a\u8fc7\u952e\u76d8\u6765\u5b8c\u6210\u4efb\u4f55\u53ef\u80fd\u7684\u4efb\u52a1\u3002<\/li>\n<\/ol>\n

      \u6b64\u5916\uff0cvi \u6709\u7740\u975e\u5e38\u4e30\u5bcc\u7684\u5185\u7f6e\u5e2e\u52a9\u624b\u518c\uff0c\u7a0b\u5e8f\u6253\u5f00\u540e\u5c31\u53ef\u4ee5\u901a\u8fc7 :\"help\" \u547d\u4ee4\u6765\u67e5\u770b\u3002\u8fd9\u4e2a\u5185\u7f6e\u5e2e\u52a9\u624b\u518c\u6bd4 vi\/vim \u7684 man \u9875\u9762\u5305\u542b\u4e86\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n

      \"preparation-for-lfcs202\"<\/p>\n

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

      \u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u4e0b\u8f93\u5165 vi \u6765\u542f\u52a8\u3002<\/p>\n

      \"preparation-for-lfcs203\"<\/p>\n

      \u7136\u540e\u6309\u4e0b\u5b57\u6bcd i\uff0c\u4f60\u5c31\u53ef\u4ee5\u5f00\u59cb\u8f93\u5165\u4e86\u3002\u6216\u8005\u901a\u8fc7\u4e0b\u9762\u7684\u65b9\u6cd5\u6765\u542f\u52a8 vi\uff1a<\/p>\n

      1.# vi filename<\/pre>\n

      \u8fd9\u6837\u4f1a\u6253\u5f00\u4e00\u4e2a\u540d\u4e3a filename \u7684\u7f13\u5b58\u533a\uff08\u7a0d\u540e\u4f1a\u8be6\u7ec6\u4ecb\u7ecd\u7f13\u5b58\u533a\uff09\uff0c\u5728\u4f60\u7f16\u8f91\u5b8c\u6210\u4e4b\u540e\u5c31\u53ef\u4ee5\u5b58\u50a8\u5728\u78c1\u76d8\u4e2d\u4e86\u3002<\/p>\n

      \u7406\u89e3 vi \u7684\u4e09\u4e2a\u6a21\u5f0f<\/strong><\/div>\n

      1.\u547d\u4ee4command\u6a21\u5f0f<\/strong>\uff0cvi \u5141\u8bb8\u7528\u6237\u6d4f\u89c8\u8be5\u6587\u4ef6\u5e76\u8f93\u5165\u7531\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\u7ec4\u6210\u7684\u3001\u7b80\u77ed\u7684\u3001\u5927\u5c0f\u5199\u654f\u611f\u7684 vi \u547d\u4ee4\u3002\u8fd9\u4e9b\u547d\u4ee4\u7684\u5927\u90e8\u5206\u90fd\u53ef\u4ee5\u589e\u52a0\u4e00\u4e2a\u524d\u7f00\u6570\u5b57\u8868\u793a\u6267\u884c\u6b21\u6570\u3002
      \n\u6bd4\u5982\uff1ayy\uff08\u6216Y\uff09 \u590d\u5236\u5f53\u524d\u7684\u6574\u884c\uff0c3yy\uff08\u62163Y\uff09 \u590d\u5236\u5f53\u524d\u6574\u884c\u548c\u4e0b\u8fb9\u7d27\u63a5\u7740\u7684\u4e24\u884c\uff08\u603b\u51713\u884c\uff09\u3002\u901a\u8fc7 Esc \u952e\u53ef\u4ee5\u968f\u65f6\u8fdb\u5165\u547d\u4ee4\u6a21\u5f0f\uff08\u800c\u4e0d\u7ba1\u5f53\u524d\u5de5\u4f5c\u5728\u4ec0\u4e48\u6a21\u5f0f\u4e0b\uff09\u3002\u4e8b\u5b9e\u4e0a\uff0c\u5728\u547d\u4ee4\u6a21\u5f0f\u4e0b\uff0c\u952e\u76d8\u4e0a\u6240\u6709\u7684\u8f93\u5165\u90fd\u88ab\u89e3\u91ca\u4e3a\u547d\u4ee4\u800c\u975e\u6587\u672c\uff0c\u8fd9\u5f80\u5f80\u4f7f\u5f97\u521d\u5b66\u8005\u56f0\u60d1\u4e0d\u5df2\u3002<\/p>\n

      2.\u672b\u884cex\u6a21\u5f0f<\/strong>\uff0c\u6211\u4eec\u53ef\u4ee5\u5904\u7406\u6587\u4ef6\uff08\u5305\u62ec\u4fdd\u5b58\u5f53\u524d\u6587\u4ef6\u548c\u8fd0\u884c\u5916\u90e8\u7a0b\u5e8f\uff09\u3002\u6211\u4eec\u5fc5\u987b\u5728\u547d\u4ee4\u6a21\u5f0f\u4e0b\u8f93\u5165\u4e00\u4e2a\u5192\u53f7\uff08:\uff09\uff0c\u624d\u80fd\u8fdb\u5165\u8fd9\u4e2a\u6a21\u5f0f\uff0c\u7d27\u63a5\u7740\u662f\u8981\u5728\u672b\u884c\u6a21\u5f0f\u4e0b\u4f7f\u7528\u7684\u547d\u4ee4\u3002\u6267\u884c\u4e4b\u540e vi \u81ea\u52a8\u56de\u5230\u547d\u4ee4\u6a21\u5f0f\u3002<\/p>\n

      3.\u6587\u672c\u8f93\u5165insert\u6a21\u5f0f\uff08\u901a\u5e38\u5728\u547d\u4ee4\u6a21\u5f0f\u4e0b\u4f7f\u7528\u5b57\u6bcd i \u8fdb\u5165\u8fd9\u4e2a\u6a21\u5f0f\uff09<\/strong>\uff0c\u6211\u4eec\u53ef\u4ee5\u968f\u610f\u8f93\u5165\u6587\u672c\u3002\u5927\u591a\u6570\u7684\u952e\u5165\u5c06\u4ee5\u6587\u672c\u5f62\u5f0f\u8f93\u51fa\u5230\u5c4f\u5e55\uff08\u4e00\u4e2a\u91cd\u8981\u7684\u4f8b\u5916\u662fEsc\u952e\uff0c\u5b83\u5c06\u9000\u51fa\u6587\u672c\u7f16\u8f91\u6a21\u5f0f\u5e76\u56de\u5230\u547d\u4ee4\u6a21\u5f0f\uff09\u3002<\/p>\n

      \"preparation-for-lfcs204\"<\/p>\n

      vi \u547d\u4ee4<\/strong><\/div>\n

      \u4e0b\u9762\u5217\u51fa\u5e38\u7528\u7684 vi \u547d\u4ee4\u3002\u6587\u4ef6\u7f16\u8f91\u7684\u547d\u4ee4\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u53f9\u53f7\u7684\u547d\u4ee4\u5f3a\u5236\u6267\u884c\uff08\u5982\uff0c:q! \u547d\u4ee4\u5f3a\u5236\u9000\u51fa\u7f16\u8f91\u5668\u800c\u4e0d\u4fdd\u5b58\u6587\u4ef6\uff09\u3002
      \nh \u6216 \u2190<\/strong>\u00a0 \u5149\u6807\u5de6\u79fb\u4e00\u4e2a\u5b57\u7b26
      \nj \u6216 \u2193\u00a0<\/strong> \u5149\u6807\u4e0b\u79fb\u4e00\u884c
      \nk \u6216 \u2191<\/strong>\u00a0 \u5149\u6807\u4e0a\u79fb\u4e00\u884c
      \nl (\u5c0f\u5199\u5b57\u6bcd L) \u6216 \u2192<\/strong>\u00a0 \u5149\u6807\u53f3\u79fb\u4e00\u4e2a\u5b57\u7b26
      \nH<\/strong>\u00a0 \u5149\u6807\u79fb\u81f3\u5c4f\u5e55\u9876\u884c
      \nL\u00a0<\/strong> \u5149\u6807\u79fb\u81f3\u5c4f\u5e55\u672b\u884c
      \nG\u00a0<\/strong> \u5149\u6807\u79fb\u81f3\u6587\u4ef6\u672b\u884c
      \nw<\/strong>\u00a0 \u5149\u6807\u53f3\u79fb\u4e00\u4e2a\u8bcd
      \nb<\/strong>\u00a0 \u5149\u6807\u5de6\u79fb\u4e00\u4e2a\u8bcd
      \n0 (\u6570\u5b57\u96f6)<\/strong>\u00a0 \u5149\u6807\u79fb\u81f3\u884c\u9996
      \n^<\/strong>\u00a0 \u5149\u6807\u79fb\u81f3\u5f53\u524d\u884c\u7b2c\u4e00\u4e2a\u975e\u7a7a\u683c\u5b57\u7b26
      \n$<\/strong>\u00a0 \u5149\u6807\u79fb\u81f3\u5f53\u524d\u884c\u884c\u5c3e
      \nCtrl-B<\/strong>\u00a0 \u5411\u540e\u7ffb\u9875
      \nCtrl-F<\/strong>\u00a0 \u5411\u524d\u7ffb\u9875
      \ni<\/strong>\u00a0 \u5728\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u63d2\u5165\u6587\u672c
      \nI (\u5927\u5199\u5b57\u6bcd i)<\/strong>\u00a0 \u5728\u5f53\u524d\u884c\u9996\u63d2\u5165\u6587\u672c
      \nJ (\u5927\u5199\u5b57\u6bcd j)<\/strong>\u00a0 \u5c06\u4e0b\u4e00\u884c\u4e0e\u5f53\u524d\u884c\u5408\u5e76\uff08\u4e0b\u4e00\u884c\u4e0a\u79fb\u5230\u5f53\u524d\u884c\uff09
      \na<\/strong>\u00a0 \u5728\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u540e\u8ffd\u52a0\u6587\u672c
      \no (\u5c0f\u5199\u5b57\u6bcd O)\u00a0<\/strong> \u5728\u5f53\u524d\u884c\u4e0b\u8fb9\u63d2\u5165\u7a7a\u767d\u884c
      \nO (\u5927\u5199\u5b57\u6bcd O)\u00a0<\/strong> \u5728\u5f53\u524d\u884c\u4e0a\u8fb9\u63d2\u5165\u7a7a\u767d\u884c
      \nr<\/strong>\u00a0 \u66ff\u6362\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u7684\u4e00\u4e2a\u5b57\u7b26
      \nR<\/strong>\u00a0 \u4ece\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u5f00\u59cb\u8986\u76d6\u63d2\u5165\u6587\u672c
      \nx<\/strong>\u00a0 \u5220\u9664\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u7684\u5b57\u7b26
      \nX<\/strong>\u00a0 \u7acb\u5373\u5220\u9664\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u4e4b\u524d\uff08\u5de6\u8fb9\uff09\u7684\u4e00\u4e2a\u5b57\u7b26
      \ndd\u00a0<\/strong> \u526a\u5207\u5f53\u524d\u6574\u884c\u6587\u672c\uff08\u4e3a\u4e86\u4e4b\u540e\u8fdb\u884c\u7c98\u8d34\uff09
      \nD\u00a0<\/strong> \u526a\u5207\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u5230\u884c\u672b\u7684\u6587\u672c\uff08\u8be5\u547d\u4ee4\u7b49\u6548\u4e8e d$\uff09
      \nyX<\/strong>\u00a0 \u7ed9\u51fa\u4e00\u4e2a\u79fb\u52a8\u547d\u4ee4 X \uff08\u5982 h\u3001j\u3001H\u3001L \u7b49\uff09\uff0c\u590d\u5236\u9002\u5f53\u6570\u91cf\u7684\u5b57\u7b26\u3001\u5355\u8bcd\u6216\u8005\u4ece\u5149\u6807\u5f00\u59cb\u5230\u4e00\u5b9a\u6570\u91cf\u7684\u884c
      \nyy \u6216 Y<\/strong>\u00a0 \u590d\u5236\u5f53\u524d\u6574\u884c
      \np<\/strong>\u00a0 \u7c98\u8d34\u5728\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u4e4b\u540e\uff08\u4e0b\u4e00\u884c\uff09
      \nP\u00a0<\/strong> \u7c98\u8d34\u5728\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u4e4b\u524d\uff08\u4e0a\u4e00\u884c\uff09
      \n. (\u53e5\u70b9)\u00a0<\/strong> \u91cd\u590d\u6700\u540e\u4e00\u4e2a\u547d\u4ee4
      \nu<\/strong>\u00a0 \u64a4\u9500\u6700\u540e\u4e00\u4e2a\u547d\u4ee4
      \nU\u00a0<\/strong> \u64a4\u9500\u6700\u540e\u4e00\u884c\u7684\u6700\u540e\u4e00\u4e2a\u547d\u4ee4\uff0c\u53ea\u6709\u5149\u6807\u4ecd\u5728\u6700\u540e\u4e00\u884c\u624d\u80fd\u6267\u884c\u3002
      \nn\u00a0<\/strong> \u5728\u67e5\u627e\u4e2d\u8df3\u5230\u4e0b\u4e00\u4e2a\u5339\u914d\u9879
      \nN<\/strong>\u00a0 \u5728\u67e5\u627e\u4e2d\u8df3\u5230\u524d\u4e00\u4e2a\u5339\u914d\u9879
      \n:n\u00a0<\/strong> \u4e0b\u4e00\u4e2a\u6587\u4ef6\uff0c\u7f16\u8f91\u591a\u4e2a\u6307\u5b9a\u6587\u4ef6\u65f6\uff0c\u8be5\u547d\u4ee4\u52a0\u8f7d\u4e0b\u4e00\u4e2a\u6587\u4ef6\u3002
      \n:e file<\/strong>\u00a0 \u52a0\u8f7d\u65b0\u6587\u4ef6\u6765\u66ff\u4ee3\u5f53\u524d\u6587\u4ef6
      \n:r file\u00a0<\/strong> \u5c06\u65b0\u6587\u4ef6\u7684\u5185\u5bb9\u63d2\u5165\u5230\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u7684\u4e0b\u4e00\u884c
      \n:q<\/strong> \u00a0\u9000\u51fa\u5e76\u653e\u5f03\u66f4\u6539
      \n:w file<\/strong>\u00a0 \u5c06\u5f53\u671f\u6253\u5f00\u7684\u7f13\u5b58\u533a\u4fdd\u5b58\u4e3afile\u3002\u5982\u679c\u662f\u8ffd\u52a0\u5230\u5df2\u5b58\u5728\u7684\u6587\u4ef6\u4e2d\uff0c\u5219\u4f7f\u7528 \uff1aw >> file \u547d\u4ee4
      \n:wq<\/strong>\u00a0 \u4fdd\u5b58\u5f53\u524d\u6587\u4ef6\u7684\u5185\u5bb9\u5e76\u9000\u51fa\u3002\u7b49\u6548\u4e8e x! \u548c ZZ
      \n:r! command<\/strong>\u00a0 \u6267\u884c command \u547d\u4ee4\uff0c\u5e76\u5c06\u547d\u4ee4\u7684\u8f93\u51fa\u63d2\u5165\u5230\u5149\u6807\u6240\u5728\u4f4d\u7f6e\u7684\u4e0b\u4e00\u884c<\/p>\n

      vi \u9009\u9879<\/strong><\/div>\n

      \u4e0b\u5217\u9009\u9879\u53ef\u4ee5\u8ba9\u4f60\u5728\u8fd0\u884c Vim \u7684\u65f6\u5019\u5f88\u65b9\u4fbf\uff08\u9700\u8981\u5199\u5165\u5230\" ~\/.vimrc\" \u6587\u4ef6\uff09\uff1a<\/p>\n

      1.# echo set number >> ~\/.vimrc\r\n2.# echo syntax on >> ~\/.vimrc\r\n3.# echo set tabstop=4 >> ~\/.vimrc\r\n4.# echo set autoindent >> ~\/.vimrc\r\n<\/pre>\n

      \"preparation-for-lfcs205\"<\/p>\n

        \n
      • \u2022set number<\/strong> \u5f53 vi \u6253\u5f00\u6216\u65b0\u5efa\u6587\u4ef6\u65f6\uff0c\u663e\u793a\u884c\u53f7\u3002<\/li>\n
      • \u2022syntax on<\/strong> \u6253\u5f00\u8bed\u6cd5\u9ad8\u4eae\uff08\u5bf9\u5e94\u591a\u4e2a\u6587\u4ef6\u6269\u5c55\u540d\uff09\uff0c\u4ee5\u4fbf\u6e90\u7801\u6587\u4ef6\u548c\u914d\u7f6e\u6587\u4ef6\u66f4\u5177\u53ef\u8bfb\u6027\u3002<\/li>\n
      • \u2022set tabstop=4<\/strong> \u8bbe\u7f6e\u5236\u8868\u7b26\u95f4\u8ddd\u4e3a 4 \u4e2a\u7a7a\u683c\uff08\u9ed8\u8ba4\u4e3a 8\uff09\u3002<\/li>\n
      • \u2022set autoindent<\/strong> \u5c06\u524d\u4e00\u884c\u7684\u7f29\u8fdb\u5e94\u7528\u4e8e\u4e0b\u4e00\u884c\u3002<\/li>\n<\/ul>\n
        \u67e5\u627e\u548c\u66ff\u6362<\/strong><\/div>\n

        vi \u5177\u6709\u901a\u8fc7\u67e5\u627e\u5c06\u5149\u6807\u79fb\u52a8\u5230\uff08\u5728\u5355\u72ec\u4e00\u884c\u6216\u8005\u6574\u4e2a\u6587\u4ef6\u4e2d\u7684\uff09\u6307\u5b9a\u4f4d\u7f6e\u3002\u5b83\u8fd8\u53ef\u81ea\u52a8\u6216\u8005\u901a\u8fc7\u7528\u6237\u786e\u8ba4\u6765\u6267\u884c\u6587\u672c\u66ff\u6362\u3002<\/p>\n

        a) \u5728\u884c\u5185\u67e5\u627e\u3002f \u547d\u4ee4\u5728\u5f53\u524d\u884c\u67e5\u627e\u6307\u5b9a\u5b57\u7b26\uff0c\u5e76\u5c06\u5149\u6807\u79fb\u52a8\u5230\u6307\u5b9a\u5b57\u7b26\u51fa\u73b0\u7684\u4f4d\u7f6e\u3002<\/p>\n

        \u4f8b\u5982\uff0c\u547d\u4ee4 fh \u4f1a\u5728\u672c\u884c\u4e2d\u5c06\u5149\u6807\u79fb\u52a8\u5230\u5b57\u6bcdh\u4e0b\u4e00\u6b21\u51fa\u73b0\u7684\u4f4d\u7f6e\u3002\u6ce8\u610f\uff0c\u5b57\u6bcd f \u548c\u4f60\u8981\u67e5\u627e\u7684\u5b57\u7b26\u90fd\u4e0d\u4f1a\u51fa\u73b0\u5728\u5c4f\u5e55\u4e0a\uff0c\u4f46\u662f\u5f53\u4f60\u6309\u4e0b\u56de\u8f66\u7684\u65f6\u5019\uff0c\u8981\u67e5\u627e\u7684\u5b57\u7b26\u4f1a\u88ab\u9ad8\u4eae\u663e\u793a\u3002<\/p>\n

        \u6bd4\u5982\uff0c\u4ee5\u4e0b\u662f\u5728\u547d\u4ee4\u6a21\u5f0f\u6309\u4e0b f4 \u4e4b\u540e\u7684\u7ed3\u679c\u3002<\/p>\n

        \"preparation-for-lfcs206\"<\/p>\n

        b) \u5728\u6574\u4e2a\u6587\u4ef6\u5185\u67e5\u627e\u3002\u4f7f\u7528 \/ \u547d\u4ee4\uff0c\u7d27\u63a5\u7740\u9700\u8981\u67e5\u627e\u7684\u5355\u8bcd\u6216\u77ed\u8bed\u3002\u8fd9\u4e2a\u67e5\u627e\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528 n \u547d\u4ee4\u6216\u8005 N \u91cd\u590d\u67e5\u627e\u4e0a\u4e00\u4e2a\u67e5\u627e\u7684\u5b57\u7b26\u4e32\u3002\u4ee5\u4e0b\u662f\u5728\u547d\u4ee4\u6a21\u5f0f\u952e\u5165 \/Jane \u7684\u67e5\u627e\u7ed3\u679c\u3002<\/p>\n

        \"preparation-for-lfcs207\"<\/p>\n

        c) vi \u901a\u8fc7\u4f7f\u7528\u547d\u4ee4\u6765\u5b8c\u6210\u591a\u884c\u6216\u8005\u6574\u4e2a\u6587\u4ef6\u7684\u66ff\u6362\u64cd\u4f5c\uff08\u7c7b\u4f3c\u4e8e sed\uff09\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff0c\u4f7f\u5f97\u6574\u4e2a\u6587\u4ef6\u4e2d\u7684\u5355\u8bcd \u201cold\u201d \u66ff\u6362\u4e3a \u201cyoung\u201d\u3002<\/p>\n

        1.:%s\/old\/young\/g<\/pre>\n

        \u6ce8\u610f\uff1a\u5192\u53f7\u4f4d\u4e8e\u547d\u4ee4\u7684\u6700\u524d\u9762\u3002<\/p>\n

        \"preparation-for-lfcs208\"<\/p>\n

        \u5192\u53f7 (:) \u8fdb\u5165\u672b\u884c\u6a21\u5f0f\uff0c\u5728\u672c\u4f8b\u4e2d s \u8868\u793a\u66ff\u6362\uff0c% \u662f\u4ece\u7b2c\u4e00\u884c\u5230\u6700\u540e\u4e00\u884c\u7684\u8868\u793a\u65b9\u5f0f\uff08\u4e5f\u53ef\u4ee5\u4f7f\u7528 nm \u8868\u793a\u8303\u56f4\uff0c\u5373\u7b2c n \u884c\u5230\u7b2c m \u884c\uff09\uff0cold \u662f\u67e5\u627e\u6a21\u5f0f\uff0cyoung \u662f\u7528\u6765\u66ff\u6362\u7684\u6587\u672c\uff0cg \u8868\u793a\u5728\u6bcf\u4e2a\u67e5\u627e\u51fa\u6765\u7684\u5b57\u7b26\u4e32\u90fd\u8fdb\u884c\u66ff\u6362\u3002<\/p>\n

        \u53e6\u5916\uff0c\u5728\u547d\u4ee4\u6700\u540e\u589e\u52a0\u4e00\u4e2a c\uff0c\u53ef\u4ee5\u5728\u6bcf\u4e00\u4e2a\u5339\u914d\u9879\u66ff\u6362\u524d\u8fdb\u884c\u786e\u8ba4\u3002<\/p>\n

        1.:%s\/old\/young\/gc<\/pre>\n

        \u5c06\u65e7\u6587\u672c\u66ff\u6362\u4e3a\u65b0\u6587\u672c\u524d\uff0cvi\/vim \u4f1a\u5411\u6211\u4eec\u663e\u793a\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n

        \"preparation-for-lfcs209\"<\/p>\n