{"id":45038,"date":"2025-06-22T02:22:59","date_gmt":"2025-06-21T18:22:59","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/45038.html"},"modified":"2025-06-22T02:22:59","modified_gmt":"2025-06-21T18:22:59","slug":"vim-%e7%bc%96%e8%be%91%e6%a8%a1%e5%bc%8f-%e5%91%bd%e4%bb%a4%e6%a8%a1%e5%bc%8f-%e8%a7%86%e5%9b%be%e6%a8%a1%e5%bc%8f%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/45038.html","title":{"rendered":"vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4"},"content":{"rendered":"<p>\u4ee5\u4e0b\u662f\u4e00\u4efd Vim \u547d\u4ee4\u5927\u5168&#xff0c;\u6db5\u76d6 \u7f16\u8f91\u6a21\u5f0f&#xff08;Insert Mode&#xff09;\u3001\u547d\u4ee4\u6a21\u5f0f&#xff08;Normal Mode&#xff09; \u548c \u89c6\u56fe\u6a21\u5f0f&#xff08;Visual Mode&#xff09; \u7684\u5e38\u7528\u64cd\u4f5c&#xff0c;\u9002\u5408\u521d\u5b66\u8005\u548c\u8fdb\u9636\u7528\u6237\u4f7f\u7528\u3002<\/p>\n<hr \/>\n<h2>&#x1f9fe; Vim \u6a21\u5f0f\u7b80\u4ecb<\/h2>\n<p>Vim \u662f\u4e00\u4e2a\u6a21\u5f0f\u5316\u7f16\u8f91\u5668&#xff0c;\u4e3b\u8981\u6709\u4ee5\u4e0b\u51e0\u79cd\u6a21\u5f0f&#xff1a;<\/p>\n<table>\n<tr>\u6a21\u5f0f\u8fdb\u5165\u65b9\u5f0f\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>\u6b63\u5e38\u6a21\u5f0f&#xff08;Normal Mode&#xff09;<\/td>\n<td>\u542f\u52a8 Vim \u9ed8\u8ba4\u8fdb\u5165\u6b64\u6a21\u5f0f<\/td>\n<td>\u53ef\u6267\u884c\u79fb\u52a8\u5149\u6807\u3001\u590d\u5236\u7c98\u8d34\u7b49\u64cd\u4f5c<\/td>\n<\/tr>\n<tr>\n<td>\u63d2\u5165\u6a21\u5f0f&#xff08;Insert Mode&#xff09;<\/td>\n<td>\u6309 i, a, o \u7b49\u952e\u8fdb\u5165<\/td>\n<td>\u53ef\u4ee5\u8f93\u5165\u6587\u672c\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>\u89c6\u89c9\u6a21\u5f0f&#xff08;Visual Mode&#xff09;<\/td>\n<td>\u6309 v, V, Ctrl &#043; v \u8fdb\u5165<\/td>\n<td>\u53ef\u4ee5\u9009\u62e9\u6587\u672c\u5757\u8fdb\u884c\u64cd\u4f5c<\/td>\n<\/tr>\n<tr>\n<td>\u547d\u4ee4\u884c\u6a21\u5f0f&#xff08;Command-line Mode&#xff09;<\/td>\n<td>\u6309 : \u6216 \/ \u8fdb\u5165<\/td>\n<td>\u6267\u884c\u4fdd\u5b58\u3001\u641c\u7d22\u3001\u66ff\u6362\u7b49\u547d\u4ee4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>&#x1f527; \u4e00\u3001\u6b63\u5e38\u6a21\u5f0f&#xff08;Normal Mode&#xff09;\u547d\u4ee4<\/h2>\n<p>\u542f\u52a8 Vim \u9ed8\u8ba4\u8fdb\u5165\u6b64\u6a21\u5f0f\u3002\u6309\u4e0b Esc \u53ef\u4ece\u5176\u4ed6\u6a21\u5f0f\u8fd4\u56de\u3002<\/p>\n<h3>&#x1f50d; \u5149\u6807\u79fb\u52a8<\/h3>\n<table>\n<tr>\u547d\u4ee4\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>h<\/td>\n<td>\u5411\u5de6\u79fb\u52a8\u4e00\u4e2a\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>j<\/td>\n<td>\u5411\u4e0b\u79fb\u52a8\u4e00\u884c<\/td>\n<\/tr>\n<tr>\n<td>k<\/td>\n<td>\u5411\u4e0a\u79fb\u52a8\u4e00\u884c<\/td>\n<\/tr>\n<tr>\n<td>l<\/td>\n<td>\u5411\u53f3\u79fb\u52a8\u4e00\u4e2a\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>w<\/td>\n<td>\u79fb\u52a8\u5230\u4e0b\u4e00\u4e2a\u5355\u8bcd\u7684\u5f00\u5934<\/td>\n<\/tr>\n<tr>\n<td>b<\/td>\n<td>\u79fb\u52a8\u5230\u4e0a\u4e00\u4e2a\u5355\u8bcd\u7684\u5f00\u5934<\/td>\n<\/tr>\n<tr>\n<td>e<\/td>\n<td>\u79fb\u52a8\u5230\u5f53\u524d\u6216\u4e0b\u4e00\u4e2a\u5355\u8bcd\u7684\u7ed3\u5c3e<\/td>\n<\/tr>\n<tr>\n<td>0<\/td>\n<td>\u79fb\u52a8\u5230\u5f53\u524d\u884c\u7684\u884c\u9996<\/td>\n<\/tr>\n<tr>\n<td>$<\/td>\n<td>\u79fb\u52a8\u5230\u5f53\u524d\u884c\u7684\u884c\u5c3e<\/td>\n<\/tr>\n<tr>\n<td>gg<\/td>\n<td>\u8df3\u8f6c\u5230\u6587\u4ef6\u5f00\u5934<\/td>\n<\/tr>\n<tr>\n<td>G<\/td>\n<td>\u8df3\u8f6c\u5230\u6587\u4ef6\u672b\u5c3e<\/td>\n<\/tr>\n<tr>\n<td>nG<\/td>\n<td>\u8df3\u8f6c\u5230\u7b2c n \u884c&#xff08;\u5982 5G \u5230\u7b2c 5 \u884c&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Ctrl &#043; f<\/td>\n<td>\u5411\u4e0b\u7ffb\u9875<\/td>\n<\/tr>\n<tr>\n<td>Ctrl &#043; b<\/td>\n<td>\u5411\u4e0a\u7ffb\u9875<\/td>\n<\/tr>\n<tr>\n<td>Ctrl &#043; d<\/td>\n<td>\u5411\u4e0b\u6eda\u52a8\u534a\u9875<\/td>\n<\/tr>\n<tr>\n<td>Ctrl &#043; u<\/td>\n<td>\u5411\u4e0a\u6eda\u52a8\u534a\u9875<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u270f\ufe0f \u7f16\u8f91\u64cd\u4f5c<\/h3>\n<table>\n<tr>\u547d\u4ee4\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>x<\/td>\n<td>\u5220\u9664\u5f53\u524d\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>X<\/td>\n<td>\u5220\u9664\u524d\u4e00\u4e2a\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>dw<\/td>\n<td>\u5220\u9664\u4e00\u4e2a\u5355\u8bcd<\/td>\n<\/tr>\n<tr>\n<td>dd<\/td>\n<td>\u5220\u9664\u6574\u884c<\/td>\n<\/tr>\n<tr>\n<td>ndd<\/td>\n<td>\u5220\u9664 n \u884c&#xff08;\u5982 3dd \u5220\u9664 3 \u884c&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>d$<\/td>\n<td>\u5220\u9664\u4ece\u5149\u6807\u4f4d\u7f6e\u5230\u884c\u5c3e<\/td>\n<\/tr>\n<tr>\n<td>d0<\/td>\n<td>\u5220\u9664\u4ece\u5149\u6807\u4f4d\u7f6e\u5230\u884c\u9996<\/td>\n<\/tr>\n<tr>\n<td>yy<\/td>\n<td>\u590d\u5236\u5f53\u524d\u884c<\/td>\n<\/tr>\n<tr>\n<td>nyy<\/td>\n<td>\u590d\u5236 n \u884c<\/td>\n<\/tr>\n<tr>\n<td>yw<\/td>\n<td>\u590d\u5236\u4e00\u4e2a\u5355\u8bcd<\/td>\n<\/tr>\n<tr>\n<td>p<\/td>\n<td>\u5728\u5149\u6807\u4e0b\u65b9\u7c98\u8d34<\/td>\n<\/tr>\n<tr>\n<td>P<\/td>\n<td>\u5728\u5149\u6807\u4e0a\u65b9\u7c98\u8d34<\/td>\n<\/tr>\n<tr>\n<td>u<\/td>\n<td>\u64a4\u9500\u4e00\u6b21\u4fee\u6539<\/td>\n<\/tr>\n<tr>\n<td>Ctrl &#043; r<\/td>\n<td>\u91cd\u505a\u4e00\u6b21\u64a4\u9500<\/td>\n<\/tr>\n<tr>\n<td>.<\/td>\n<td>\u91cd\u590d\u4e0a\u4e00\u6b21\u7f16\u8f91\u64cd\u4f5c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u2699\ufe0f \u6587\u4ef6\u64cd\u4f5c<\/h3>\n<table>\n<tr>\u547d\u4ee4\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>:w<\/td>\n<td>\u4fdd\u5b58\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>:w filename<\/td>\n<td>\u53e6\u5b58\u4e3a filename<\/td>\n<\/tr>\n<tr>\n<td>:q<\/td>\n<td>\u9000\u51fa&#xff08;\u65e0\u4fee\u6539\u65f6&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>:q!<\/td>\n<td>\u5f3a\u5236\u9000\u51fa\u4e14\u4e0d\u4fdd\u5b58\u4fee\u6539<\/td>\n<\/tr>\n<tr>\n<td>:wq<\/td>\n<td>\u4fdd\u5b58\u5e76\u9000\u51fa<\/td>\n<\/tr>\n<tr>\n<td>:wq!<\/td>\n<td>\u5f3a\u5236\u4fdd\u5b58\u5e76\u9000\u51fa<\/td>\n<\/tr>\n<tr>\n<td>:e filename<\/td>\n<td>\u6253\u5f00\u53e6\u4e00\u4e2a\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>:set number \u6216 :set nu<\/td>\n<td>\u663e\u793a\u884c\u53f7<\/td>\n<\/tr>\n<tr>\n<td>:set nonumber \u6216 :set nonu<\/td>\n<td>\u9690\u85cf\u884c\u53f7<\/td>\n<\/tr>\n<tr>\n<td>:set list<\/td>\n<td>\u663e\u793a\u9690\u85cf\u5b57\u7b26&#xff08;\u5982\u7a7a\u683c\u3001Tab&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>:set tabstop&#061;4<\/td>\n<td>\u8bbe\u7f6e Tab \u5bbd\u5ea6\u4e3a 4 \u4e2a\u5b57\u7b26<\/td>\n<\/tr>\n<tr>\n<td>:set autoindent<\/td>\n<td>\u81ea\u52a8\u7f29\u8fdb<\/td>\n<\/tr>\n<tr>\n<td>:set paste<\/td>\n<td>\u8fdb\u5165\u7c98\u8d34\u6a21\u5f0f&#xff08;\u9632\u6b62\u81ea\u52a8\u7f29\u8fdb\u5e72\u6270&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>:set nopaste<\/td>\n<td>\u5173\u95ed\u7c98\u8d34\u6a21\u5f0f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>&#x1f50d; \u641c\u7d22\u4e0e\u66ff\u6362<\/h3>\n<table>\n<tr>\u547d\u4ee4\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>\/pattern<\/td>\n<td>\u5411\u540e\u641c\u7d22 pattern<\/td>\n<\/tr>\n<tr>\n<td>?pattern<\/td>\n<td>\u5411\u524d\u641c\u7d22 pattern<\/td>\n<\/tr>\n<tr>\n<td>n<\/td>\n<td>\u67e5\u627e\u4e0b\u4e00\u4e2a\u5339\u914d\u9879<\/td>\n<\/tr>\n<tr>\n<td>N<\/td>\n<td>\u67e5\u627e\u4e0a\u4e00\u4e2a\u5339\u914d\u9879<\/td>\n<\/tr>\n<tr>\n<td>:%s\/old\/new\/g<\/td>\n<td>\u66ff\u6362\u6574\u4e2a\u6587\u4ef6\u4e2d\u7684 old \u4e3a new<\/td>\n<\/tr>\n<tr>\n<td>:1,10s\/old\/new\/g<\/td>\n<td>\u66ff\u6362\u7b2c 1~10 \u884c\u4e2d\u7684 old \u4e3a new<\/td>\n<\/tr>\n<tr>\n<td>:s\/old\/new\/<\/td>\n<td>\u66ff\u6362\u5f53\u524d\u884c\u7b2c\u4e00\u4e2a\u5339\u914d\u9879<\/td>\n<\/tr>\n<tr>\n<td>:s\/old\/new\/g<\/td>\n<td>\u66ff\u6362\u5f53\u524d\u884c\u6240\u6709\u5339\u914d\u9879<\/td>\n<\/tr>\n<tr>\n<td>:s\/old\/new\/gc<\/td>\n<td>\u66ff\u6362\u5f53\u524d\u884c\u6240\u6709\u5339\u914d\u9879&#xff0c;\u5e76\u786e\u8ba4\u6bcf\u4e2a\u66ff\u6362<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>\u270d\ufe0f \u4e8c\u3001\u63d2\u5165\u6a21\u5f0f&#xff08;Insert Mode&#xff09;<\/h2>\n<p>\u6309\u4ee5\u4e0b\u4efb\u610f\u952e\u53ef\u8fdb\u5165\u63d2\u5165\u6a21\u5f0f&#xff0c;\u6309 Esc \u8fd4\u56de\u6b63\u5e38\u6a21\u5f0f\u3002<\/p>\n<table>\n<tr>\u547d\u4ee4\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>i<\/td>\n<td>\u5728\u5149\u6807\u524d\u63d2\u5165<\/td>\n<\/tr>\n<tr>\n<td>I<\/td>\n<td>\u5728\u884c\u9996\u63d2\u5165<\/td>\n<\/tr>\n<tr>\n<td>a<\/td>\n<td>\u5728\u5149\u6807\u540e\u63d2\u5165<\/td>\n<\/tr>\n<tr>\n<td>A<\/td>\n<td>\u5728\u884c\u5c3e\u63d2\u5165<\/td>\n<\/tr>\n<tr>\n<td>o<\/td>\n<td>\u5728\u5f53\u524d\u884c\u4e0b\u65b9\u65b0\u5efa\u4e00\u884c\u5e76\u63d2\u5165<\/td>\n<\/tr>\n<tr>\n<td>O<\/td>\n<td>\u5728\u5f53\u524d\u884c\u4e0a\u65b9\u65b0\u5efa\u4e00\u884c\u5e76\u63d2\u5165<\/td>\n<\/tr>\n<tr>\n<td>s<\/td>\n<td>\u5220\u9664\u5f53\u524d\u5b57\u7b26\u5e76\u8fdb\u5165\u63d2\u5165\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>S<\/td>\n<td>\u5220\u9664\u5f53\u524d\u884c\u5e76\u8fdb\u5165\u63d2\u5165\u6a21\u5f0f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>&#x1f9ee; \u4e09\u3001\u89c6\u89c9\u6a21\u5f0f&#xff08;Visual Mode&#xff09;<\/h2>\n<p>\u6309\u4ee5\u4e0b\u4efb\u610f\u952e\u8fdb\u5165\u89c6\u89c9\u6a21\u5f0f&#xff0c;\u7528\u4e8e\u9009\u4e2d\u6587\u672c\u8fdb\u884c\u64cd\u4f5c\u3002<\/p>\n<table>\n<tr>\u547d\u4ee4\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>v<\/td>\n<td>\u5b57\u7b26\u9009\u62e9\u6a21\u5f0f&#xff08;Character-wise Visual Mode&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>V<\/td>\n<td>\u884c\u9009\u62e9\u6a21\u5f0f&#xff08;Line-wise Visual Mode&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Ctrl &#043; v<\/td>\n<td>\u5757\u9009\u62e9\u6a21\u5f0f&#xff08;Block-wise Visual Mode&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>o<\/td>\n<td>\u5207\u6362\u5149\u6807\u8d77\u59cb\u70b9<\/td>\n<\/tr>\n<tr>\n<td>&gt;<\/td>\n<td>\u5411\u53f3\u7f29\u8fdb\u9009\u4e2d\u533a\u57df<\/td>\n<\/tr>\n<tr>\n<td>&lt;<\/td>\n<td>\u5411\u5de6\u7f29\u8fdb\u9009\u4e2d\u533a\u57df<\/td>\n<\/tr>\n<tr>\n<td>y<\/td>\n<td>\u590d\u5236\u9009\u4e2d\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>d \u6216 x<\/td>\n<td>\u5220\u9664\u9009\u4e2d\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>c<\/td>\n<td>\u5220\u9664\u9009\u4e2d\u5185\u5bb9\u5e76\u8fdb\u5165\u63d2\u5165\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>:<\/td>\n<td>\u5bf9\u9009\u4e2d\u533a\u57df\u6267\u884c\u547d\u4ee4&#xff08;\u5982 :&#039;&lt;,&#039;&gt;s\/old\/new\/g&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>&#x1f4a1; \u56db\u3001\u547d\u4ee4\u884c\u6a21\u5f0f&#xff08;Command-line Mode&#xff09;<\/h2>\n<p>\u6309 : \u6216 \/ \u6216 ? \u8fdb\u5165\u8be5\u6a21\u5f0f&#xff0c;\u7528\u4e8e\u6267\u884c\u547d\u4ee4\u3002<\/p>\n<table>\n<tr>\u547d\u4ee4\u529f\u80fd<\/tr>\n<tbody>\n<tr>\n<td>:w<\/td>\n<td>\u4fdd\u5b58<\/td>\n<\/tr>\n<tr>\n<td>:q<\/td>\n<td>\u9000\u51fa<\/td>\n<\/tr>\n<tr>\n<td>:wq<\/td>\n<td>\u4fdd\u5b58\u5e76\u9000\u51fa<\/td>\n<\/tr>\n<tr>\n<td>:q!<\/td>\n<td>\u4e0d\u4fdd\u5b58\u5f3a\u5236\u9000\u51fa<\/td>\n<\/tr>\n<tr>\n<td>:\/pattern<\/td>\n<td>\u641c\u7d22 pattern \u5e76\u8df3\u8f6c\u5230\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u4f4d\u7f6e<\/td>\n<\/tr>\n<tr>\n<td>:help<\/td>\n<td>\u6253\u5f00\u5e2e\u52a9\u6587\u6863<\/td>\n<\/tr>\n<tr>\n<td>:help keyword<\/td>\n<td>\u67e5\u627e\u5173\u952e\u5b57\u7684\u5e2e\u52a9\u4fe1\u606f<\/td>\n<\/tr>\n<tr>\n<td>:registers<\/td>\n<td>\u67e5\u770b\u526a\u8d34\u677f\u5bc4\u5b58\u5668\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>:map<\/td>\n<td>\u67e5\u770b\u6309\u952e\u6620\u5c04<\/td>\n<\/tr>\n<tr>\n<td>:syntax on\/off<\/td>\n<td>\u5f00\u542f\/\u5173\u95ed\u8bed\u6cd5\u9ad8\u4eae<\/td>\n<\/tr>\n<tr>\n<td>:filetype plugin indent on<\/td>\n<td>\u5f00\u542f\u667a\u80fd\u7f29\u8fdb\u548c\u63d2\u4ef6\u652f\u6301<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>&#x1f3a8; \u4e94\u3001\u9ad8\u7ea7\u6280\u5de7&#xff08;\u53ef\u9009&#xff09;<\/h2>\n<table>\n<tr>\u6280\u5de7\u547d\u4ee4<\/tr>\n<tbody>\n<tr>\n<td>\u591a\u7a97\u53e3\u5206\u5c4f<\/td>\n<td>:split&#xff08;\u6c34\u5e73&#xff09;\u6216 :vsplit&#xff08;\u5782\u76f4&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5207\u6362\u7a97\u53e3<\/td>\n<td>Ctrl &#043; w &#043; \u65b9\u5411\u952e<\/td>\n<\/tr>\n<tr>\n<td>\u6253\u5f00\u591a\u4e2a\u6587\u4ef6<\/td>\n<td>vim file1 file2<\/td>\n<\/tr>\n<tr>\n<td>\u5728\u591a\u4e2a\u6587\u4ef6\u4e4b\u95f4\u5207\u6362<\/td>\n<td>:next \/ :prev \/ :first \/ :last<\/td>\n<\/tr>\n<tr>\n<td>\u52a0\u8f7d\u63d2\u4ef6\u7ba1\u7406\u5668&#xff08;\u5982 Plug&#xff09;<\/td>\n<td>:PlugInstall&#xff08;\u9700\u914d\u7f6e vim-plug&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u4f7f\u7528\u5b8f\u5f55\u5236<\/td>\n<td>q{a-z} \u5f55\u5236\u5b8f&#xff0c;&#064;{a-z} \u6267\u884c\u5b8f<\/td>\n<\/tr>\n<tr>\n<td>\u5feb\u901f\u6ce8\u91ca\u4ee3\u7801&#xff08;\u7ed3\u5408\u63d2\u4ef6&#xff09;<\/td>\n<td>\u5982 NERD Commenter: &lt;leader&gt;cc \u6ce8\u91ca\u9009\u4e2d\u884c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h2>&#x1f4c4; \u516d\u3001\u5b9e\u7528\u793a\u4f8b<\/h2>\n<h4>\u793a\u4f8b 1&#xff1a;\u67e5\u627e\u5e76\u66ff\u6362<\/h4>\n<p>:%s\/foo\/bar\/g<\/p>\n<p>\u5c06\u5168\u6587\u4e2d\u6240\u6709 foo \u66ff\u6362\u4e3a bar<\/p>\n<h4>\u793a\u4f8b 2&#xff1a;\u663e\u793a\u884c\u53f7\u5e76\u8df3\u8f6c\u5230\u7b2c 50 \u884c<\/h4>\n<p>:set number<br \/>\n:50<\/p>\n<h4>\u793a\u4f8b 3&#xff1a;\u591a\u7a97\u53e3\u6253\u5f00\u4e24\u4e2a\u6587\u4ef6<\/h4>\n<p>:split otherfile.txt<\/p>\n<h4>\u793a\u4f8b 4&#xff1a;\u5feb\u901f\u5220\u9664 5 \u884c<\/h4>\n<p>5dd<\/p>\n<hr \/>\n<h2>&#x1f4da; \u603b\u7ed3\u8868\u683c<\/h2>\n<table>\n<tr>\u64cd\u4f5c\u547d\u4ee4<\/tr>\n<tbody>\n<tr>\n<td>\u8fdb\u5165\u63d2\u5165\u6a21\u5f0f<\/td>\n<td>i, a, o \u7b49<\/td>\n<\/tr>\n<tr>\n<td>\u8fd4\u56de\u6b63\u5e38\u6a21\u5f0f<\/td>\n<td>Esc<\/td>\n<\/tr>\n<tr>\n<td>\u5220\u9664\u5b57\u7b26<\/td>\n<td>x<\/td>\n<\/tr>\n<tr>\n<td>\u5220\u9664\u884c<\/td>\n<td>dd<\/td>\n<\/tr>\n<tr>\n<td>\u590d\u5236\u884c<\/td>\n<td>yy<\/td>\n<\/tr>\n<tr>\n<td>\u7c98\u8d34<\/td>\n<td>p<\/td>\n<\/tr>\n<tr>\n<td>\u64a4\u9500<\/td>\n<td>u<\/td>\n<\/tr>\n<tr>\n<td>\u91cd\u505a<\/td>\n<td>Ctrl &#043; r<\/td>\n<\/tr>\n<tr>\n<td>\u4fdd\u5b58<\/td>\n<td>:w<\/td>\n<\/tr>\n<tr>\n<td>\u9000\u51fa<\/td>\n<td>:q<\/td>\n<\/tr>\n<tr>\n<td>\u4fdd\u5b58\u5e76\u9000\u51fa<\/td>\n<td>:wq<\/td>\n<\/tr>\n<tr>\n<td>\u641c\u7d22<\/td>\n<td>\/keyword<\/td>\n<\/tr>\n<tr>\n<td>\u66ff\u6362<\/td>\n<td>:%s\/old\/new\/g<\/td>\n<\/tr>\n<tr>\n<td>\u663e\u793a\u884c\u53f7<\/td>\n<td>:set number<\/td>\n<\/tr>\n<tr>\n<td>\u8fdb\u5165\u9009\u62e9\u6a21\u5f0f<\/td>\n<td>v, V, Ctrl &#043; v<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<p>\u5982\u679c\u4f60\u662f\u65b0\u624b&#xff0c;\u53ef\u4ee5\u5148\u638c\u63e1\u4ee5\u4e0b\u6838\u5fc3\u547d\u4ee4&#xff1a;<\/p>\n<p>i           # \u8fdb\u5165\u63d2\u5165\u6a21\u5f0f<br \/>\nEsc         # \u8fd4\u56de\u6b63\u5e38\u6a21\u5f0f<br \/>\n:wq         # \u4fdd\u5b58\u5e76\u9000\u51fa<br \/>\n\ud83d\ude21          # \u4fdd\u5b58\u5e76\u9000\u51fa&#xff08;\u7b80\u5199&#xff09;<br \/>\ndd          # \u5220\u9664\u4e00\u884c<br \/>\nyy p        # \u590d\u5236\u7c98\u8d34\u4e00\u884c<br \/>\nu           # \u64a4\u9500<br \/>\nCtrl &#043; r    # \u91cd\u505a<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb641\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf16\u6b21\u3002Vim \u662f\u4e00\u4e2a\u6a21\u5f0f\u5316\u7f16\u8f91\u5668\u6a21\u5f0f\u8fdb\u5165\u65b9\u5f0f\u8bf4\u660e\u6b63\u5e38\u6a21\u5f0f\uff08Normal Mode\uff09\u542f\u52a8 Vim \u9ed8\u8ba4\u8fdb\u5165\u6b64\u6a21\u5f0f\u53ef\u6267\u884c\u79fb\u52a8\u5149\u6807\u3001\u590d\u5236\u7c98\u8d34\u7b49\u64cd\u4f5c\u63d2\u5165\u6a21\u5f0f\uff08Insert Mode\uff09\u6309iao\u7b49\u952e\u8fdb\u5165\u53ef\u4ee5\u8f93\u5165\u6587\u672c\u5185\u5bb9\u89c6\u89c9\u6a21\u5f0f\uff08Visual Mode\uff09\u6309vVCtrl + v\u8fdb\u5165\u53ef\u4ee5\u9009\u62e9\u6587\u672c\u5757\u8fdb\u884c\u64cd\u4f5c\u547d\u4ee4\u884c\u6a21\u5f0f\uff08Command-line Mode\uff09\u6309\u6216\u8fdb\u5165\u6267\u884c\u4fdd\u5b58\u3001\u641c\u7d22\u3001\u66ff\u6362\u7b49\u547d\u4ee4\u64cd\u4f5c\u547d\u4ee4\u8fdb\u5165\u63d2\u5165\u6a21\u5f0fiao\u7b49\u8fd4\u56de\u6b63\u5e38\u6a21\u5f0fEsc\u5220\u9664\u5b57\u7b26x\u5220\u9664\u884cdd\u590d\u5236\u884cyy\u7c98\u8d34p\u64a4\u9500u\u91cd\u505aCtrl + r\u4fdd\u5b58\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1374,1802,3908],"topic":[],"class_list":["post-45038","post","type-post","status-publish","format-standard","hentry","category-server","tag-excel","tag-vim","tag-3908"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/45038.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb641\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf16\u6b21\u3002Vim \u662f\u4e00\u4e2a\u6a21\u5f0f\u5316\u7f16\u8f91\u5668\u6a21\u5f0f\u8fdb\u5165\u65b9\u5f0f\u8bf4\u660e\u6b63\u5e38\u6a21\u5f0f\uff08Normal Mode\uff09\u542f\u52a8 Vim \u9ed8\u8ba4\u8fdb\u5165\u6b64\u6a21\u5f0f\u53ef\u6267\u884c\u79fb\u52a8\u5149\u6807\u3001\u590d\u5236\u7c98\u8d34\u7b49\u64cd\u4f5c\u63d2\u5165\u6a21\u5f0f\uff08Insert Mode\uff09\u6309iao\u7b49\u952e\u8fdb\u5165\u53ef\u4ee5\u8f93\u5165\u6587\u672c\u5185\u5bb9\u89c6\u89c9\u6a21\u5f0f\uff08Visual Mode\uff09\u6309vVCtrl + v\u8fdb\u5165\u53ef\u4ee5\u9009\u62e9\u6587\u672c\u5757\u8fdb\u884c\u64cd\u4f5c\u547d\u4ee4\u884c\u6a21\u5f0f\uff08Command-line Mode\uff09\u6309\u6216\u8fdb\u5165\u6267\u884c\u4fdd\u5b58\u3001\u641c\u7d22\u3001\u66ff\u6362\u7b49\u547d\u4ee4\u64cd\u4f5c\u547d\u4ee4\u8fdb\u5165\u63d2\u5165\u6a21\u5f0fiao\u7b49\u8fd4\u56de\u6b63\u5e38\u6a21\u5f0fEsc\u5220\u9664\u5b57\u7b26x\u5220\u9664\u884cdd\u590d\u5236\u884cyy\u7c98\u8d34p\u64a4\u9500u\u91cd\u505aCtrl + r\u4fdd\u5b58\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/45038.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-21T18:22:59+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/45038.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/45038.html\",\"name\":\"vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-21T18:22:59+00:00\",\"dateModified\":\"2025-06-21T18:22:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/45038.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/45038.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/45038.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/45038.html","og_locale":"zh_CN","og_type":"article","og_title":"vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb641\u6b21\uff0c\u70b9\u8d5e23\u6b21\uff0c\u6536\u85cf16\u6b21\u3002Vim \u662f\u4e00\u4e2a\u6a21\u5f0f\u5316\u7f16\u8f91\u5668\u6a21\u5f0f\u8fdb\u5165\u65b9\u5f0f\u8bf4\u660e\u6b63\u5e38\u6a21\u5f0f\uff08Normal Mode\uff09\u542f\u52a8 Vim \u9ed8\u8ba4\u8fdb\u5165\u6b64\u6a21\u5f0f\u53ef\u6267\u884c\u79fb\u52a8\u5149\u6807\u3001\u590d\u5236\u7c98\u8d34\u7b49\u64cd\u4f5c\u63d2\u5165\u6a21\u5f0f\uff08Insert Mode\uff09\u6309iao\u7b49\u952e\u8fdb\u5165\u53ef\u4ee5\u8f93\u5165\u6587\u672c\u5185\u5bb9\u89c6\u89c9\u6a21\u5f0f\uff08Visual Mode\uff09\u6309vVCtrl + v\u8fdb\u5165\u53ef\u4ee5\u9009\u62e9\u6587\u672c\u5757\u8fdb\u884c\u64cd\u4f5c\u547d\u4ee4\u884c\u6a21\u5f0f\uff08Command-line Mode\uff09\u6309\u6216\u8fdb\u5165\u6267\u884c\u4fdd\u5b58\u3001\u641c\u7d22\u3001\u66ff\u6362\u7b49\u547d\u4ee4\u64cd\u4f5c\u547d\u4ee4\u8fdb\u5165\u63d2\u5165\u6a21\u5f0fiao\u7b49\u8fd4\u56de\u6b63\u5e38\u6a21\u5f0fEsc\u5220\u9664\u5b57\u7b26x\u5220\u9664\u884cdd\u590d\u5236\u884cyy\u7c98\u8d34p\u64a4\u9500u\u91cd\u505aCtrl + r\u4fdd\u5b58\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/45038.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-21T18:22:59+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/45038.html","url":"https:\/\/www.wsisp.com\/helps\/45038.html","name":"vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-21T18:22:59+00:00","dateModified":"2025-06-21T18:22:59+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/45038.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/45038.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/45038.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"vim \u7f16\u8f91\u6a21\u5f0f\/\u547d\u4ee4\u6a21\u5f0f\/\u89c6\u56fe\u6a21\u5f0f\u5e38\u7528\u547d\u4ee4"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/45038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=45038"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/45038\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=45038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=45038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=45038"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=45038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}