I have been using vim for quite some time and am aware that selecting blocks of text in visual mode is as simple as SHIFT+V and moving the arrow key up or
You can always just use antecedent numbers to repeat actions:
You can press vi}
to select the block surrounded with {}
brackets where your cursor is currently located.
It doesn't really matter where you are inside that block (just make sure you are in the outermost one). Also you can change {
to anything that has a pair like )
or ]
.
For selecting all in visual: Type Esc to be sure yor are in normal mode
:0
type ENTER to go to the beginning of file
vG
} means move cursor to next paragraph. so, use v}
to select entire paragraph.
In addition to what others have said, you can also expand your selection using pattern searches.
For example, v/foo will select from your current position to the next instance of "foo." If you actually wanted to expand to the next instance of "foo," on line 35, for example, just press n to expand selection to the next instance, and so on.
I don't often do it, but I know that some people use marks extensively to make visual selections. For example, if I'm on line 5 and I want to select to line 35, I might press ma to place mark a
on line 5, then :35 to move to line 35. Shift + v to enter linewise visual mode, and finally `a to select back to mark a
.
It could come in handy to know:
In order to select the same ammount of lines for example use 1v
You should have done some modification to be able to use 1v
, blockwise or linewise.
Today I saw this amazing tip from here:
:5mark < | 10mark > | normal gvV
:5mark < | 10mark > | normal gv
You can also reset the visual block boundaries doing so:
m< .......... sets the visual mode start point
m> .......... sets the visual mode end point