Is it possible to select multiple non-consecutive lines (or sections) in VIM's visual mode? If so, how?
+8
A:
No, this is not possible without plugins. But you can copy multiple lines into the same buffer, if that solves your problem. You mark a section to copy in visual mode, press "a
to operate on the buffer a
with the next command and yank it as usual (y
). Then you mark the next section and press "A
- capitalizing the buffer name means "do not overwrite the buffer, append to it instead" - and yank again using y
. You can then paste the accumulated buffer a
at any time using "ap
.
soulmerge
2009-10-22 16:03:42
I wish I could accept two responses. This is good to know too. Thank you.
Marcin
2009-10-22 19:57:18
If you would remove that "No this is not possible" bit, then I would upvote this answer.
Michael Dillon
2009-10-23 20:45:28
Not actually removed, but adjusted first sentence. Should be correct now.
soulmerge
2009-10-28 18:02:16
+9
A:
You have to install the multiselect plugin to get this capability. Find it here: http://www.vim.org/scripts/script.php?script%5Fid=953
Michael Dillon
2009-10-22 16:05:56