When I pop into Vim's visual mode to, for example, indent a block of text, the command prompt always starts with '<,'>
. Can someone break down for me why this is or rather what it does? It seems like it's got something to do with markers but I'm not entirely sure of this based on the manual stuff I've read so far.
'<
is the first line visually selected, and '>
is the last line visually selected. This is vim's way of making your command apply to only the visual area.
The '<,'>
at the beginning of your command line represents the range which you have selected . This is the also the range of test onto which the command you are about to enter would be applied.
For example if I selected a region of text in visual mode and then wanted to replace all occurrences of 'stack' with 'overflow' my command would look like:
:'<,'>s/stack/overflow/g
Without visual mode this same command would have to be accomplished by specifying the line range by hand eg:
:1,10s/helo/hello/g
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