Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select across pages in Vim?

Tags:

vim

Is there a way to visual select multiple pages in Vim?

When I press SHIFTV to enter selection mode, the keys h, j, k and l work to select more text, but page up and page down CTRLF and CTRLB exit out of the "select" mode.

FYI I am using GVIM on Windows 7.

like image 786
Andriy Drozdyuk Avatar asked Feb 07 '12 18:02

Andriy Drozdyuk


People also ask

How do I select a few lines in Vim?

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. Once the desired text is highlighted, use commands to manipulate it.

How do I select all lines in vi mode?

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.


2 Answers

You can:

  • use Ctrld and Ctrlu, which keeps a selection under mswin and moves half a page
  • put behave xterm into your vimrc file, which makes Ctrlf and Ctrlb work as well
  • use searching with / as described in post of Zsolt
like image 172
clime Avatar answered Oct 23 '22 03:10

clime


Even better, you can use / to search for something after SHIFTv and your lines will be selected till (and including) the next match.

It can be better, as you sometimes don't know what's on the next page.

like image 39
Zsolt Botykai Avatar answered Oct 23 '22 03:10

Zsolt Botykai