vim将代码块移至另一个文件-仅附加

Gan*_*ang 1 vim

使用vim将代码块从正在编辑的文件移至另一个文件。

有什么花招可以提高生产力吗?

这个问题与下面的网址很接近,但不完全相同

如何从Unix上的文本文件中提取预定范围的行?

# tasks
identity lines range in file_A where you are working
append the code block to file_B
remove the code block from file_A
Run Code Online (Sandbox Code Playgroud)

我以前的常规-4个步骤

# write down line range, exit vim
sed -n 1,33p file.pl >> lib/module.pm
vim lib/module.pm - to check
vim file.pl again to delete the code block
Run Code Online (Sandbox Code Playgroud)

yol*_*yer 6

如果不必打开目标文件,则可以这样操作: