vim指定行注释和解注释

2023-03-07 14:33:27 浏览数 (1)

1.vim底行命令模式

代码语言:javascript复制
1.64至74行首插入"#":
64, 74 s/^/#/g

 64 #[Running] python -u "Pydeco_1.py"
 65 #enter deco3 (foo)
 66 #enter deco2 (wrap_3)
 67 #enter deco1 (wrap_2)
 68 #enter wrapers_1 (2, 3)
 69 #enter wrapers_2 (2, 3)
 70 #enter wrapers_3 (2, 3)
 71 #exit wrapper_3 result   3:11
 72 #exit wrapper_2 result   1:12
 73 #exit wrapper_1 result * 2:24
 74 #24

1.64至74行首删除"#":
64,74 s/^#//g

 64 [Running] python -u "Pydeco_1.py"
 65 enter deco3 (foo)
 66 enter deco2 (wrap_3)
 67 enter deco1 (wrap_2)
 68 enter wrapers_1 (2, 3)
 69 enter wrapers_2 (2, 3)
 70 enter wrapers_3 (2, 3)
 71 exit wrapper_3 result   3:11
 72 exit wrapper_2 result   1:12
 73 exit wrapper_1 result * 2:24
 74 24

2.其实质是正则匹配替换

vim

0 人点赞