Is it possible to select multiple non-consecutive lines (or sections) in VIM's visual mode? If so, how?
Manipulate multiple lines of textPlace your cursor anywhere on the first or last line of the text you want to manipulate. Press Shift+V to enter line mode. The words VISUAL LINE will appear at the bottom of the screen. Use navigation commands, such as the Arrow keys, to highlight multiple lines of text.
So you put your cursor somewhere in a word, press *cgn , type the replacement, hit <esc> , and then hit . to change the next occurence. If you already searched for the word, ignore the * and just cgn . There do exist multi-cursor-emulation plugins for vim.
For windows: Hold down the control (ctrl) button to select multiple options. For Mac: Hold down the command button to select multiple options.
If you want to select the entire line in a file, press V. Now when you press k or j to go up and down, vim will select the entire line above and below your cursor. Finally, you can select text in columns by pressing ctrl+v and moving up or down the block.
No, this is not possible without plugins.
But you can copy multiple lines into the same buffer, if that solves your problem.
"a
to operate on the buffer a
with the next command and y
). "A
(capitalizing the buffer name means "do not overwrite the buffer, append to it instead") y
. a
at any time using "ap
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With