Vim - 视觉上 select 多个不连续的部分
Vim - visually select multiple non-consecutive sections
在 VIM 中有没有一种方法可以直观地 select 文档中没有直接连接的多个部分/非连续行?
我的目标是将文档的某些部分复制到另一个文档,在当前 VIM 实例的不同缓冲区上打开。然而,同样的程序也可用于删除这样的 select 离子。
假设在下面的示例中,我想 select 第 2,6 和 11 行。
1 global _main
2 extern _printf
3
4 section .text
5 _main:
6 push message
7 call _printf
8 add esp, 4
9 ret
10 message:
11 db 'Hello, World', 10, 0
感谢@Andrea Baldini 对 similar question I see one of the answers 一个不需要任何插件即可解决我的问题的可行解决方案的强调。
作为参考,我复制了@soulmerge
的回复
To start the 'Accumulation Buffer':
1. mark a section to copy in visual mode,
2. press "a to operate on the buffer a with the next command and
3. yank it as usual (y).
To add to that buffer:
1. mark the next section and
2. press "A (capitalizing the buffer name means "do not overwrite the buffer, append to it instead")
3. and yank again using y.
You can then paste the accumulated buffer a at any time using "ap.
在 VIM 中有没有一种方法可以直观地 select 文档中没有直接连接的多个部分/非连续行? 我的目标是将文档的某些部分复制到另一个文档,在当前 VIM 实例的不同缓冲区上打开。然而,同样的程序也可用于删除这样的 select 离子。 假设在下面的示例中,我想 select 第 2,6 和 11 行。
1 global _main
2 extern _printf
3
4 section .text
5 _main:
6 push message
7 call _printf
8 add esp, 4
9 ret
10 message:
11 db 'Hello, World', 10, 0
感谢@Andrea Baldini 对 similar question I see one of the answers 一个不需要任何插件即可解决我的问题的可行解决方案的强调。 作为参考,我复制了@soulmerge
的回复To start the 'Accumulation Buffer':
1. mark a section to copy in visual mode,
2. press "a to operate on the buffer a with the next command and
3. yank it as usual (y).
To add to that buffer:
1. mark the next section and
2. press "A (capitalizing the buffer name means "do not overwrite the buffer, append to it instead")
3. and yank again using y.
You can then paste the accumulated buffer a at any time using "ap.