如何替换Vim中接下来3行的字符?
How to replace the characters in the next 3 lines in Vim?
如何仅在第二个 if 块中将 404 替换为 403,我的光标现在位于第 45 行。
41 if( error.response.status === 404 ) {
42 router.replace('/404')
43 }
44
45 if( error.response.status === 404 ) {
46 router.replace('/404')
47 }
如果你的光标在第45行,你可以这样做,,+2
意味着包括当前行和接下来的两行
:,+2s/404/403/g
如果你的光标在任何位置,你都可以这样做
:45,+2s/404/403/g
如何仅在第二个 if 块中将 404 替换为 403,我的光标现在位于第 45 行。
41 if( error.response.status === 404 ) {
42 router.replace('/404')
43 }
44
45 if( error.response.status === 404 ) {
46 router.replace('/404')
47 }
如果你的光标在第45行,你可以这样做,,+2
意味着包括当前行和接下来的两行
:,+2s/404/403/g
如果你的光标在任何位置,你都可以这样做
:45,+2s/404/403/g