【发布时间】:2022-12-31 21:45:03
【问题描述】:
我需要一次编辑多行。我知道如何从 ctrl+v - down ... - shift+i 行的开头开始,但问题是我的变量长度不同,所以我不能用同样的技巧来添加结尾每个变量的。我当然可以在每一行上做.,但我想知道是否有更快的方法来实现相同的结果?
例子:我需要改变:
parser.add_argument('--name', type=str, help='The name of the experiment')
parser.add_argument('--debug', default=False, action='store_true', help=f'If the run is a debugging run')
parser.add_argument('--gpu_id', type=int, default=0 if torch.cuda.device_count() > 0 else -1, help='The ID of the GPU (if there is any) to run the network on (e.g., --gpu_id 1 will run the network on GPU #1 etc.)')
到:
name =
debug =
gpu_id =
所以我这样做:
- 转到第一行,点击
ctrl+v、down、down、down、shift+i - 然后删除所有内容,直到最后一个
-,而不是esc。 - 编辑每一行的结尾我可以到第一行的结尾,
shift+c,space,=。 - 然后在另一行通过
f+'、.重复此操作谢谢
【问题讨论】:
标签: vim