While I can understand the percentage sign % being chosen to represent the current file, just because you need to choose some character for that, I am curious as to why '<,'> is representative of the current visual selection.

  1. Why not just use a single character to represent the visual selection?

  2. Can these characters be parsed to have a different meaning?

  3. is '< supposed to mean something like,

    The lesser than value of the quoted text ?

  4. Are there any other useful variations of '<,'> that I should know, say for example, '>,'<?

  • 4
    Yes, it does mean something: it's a range (see :h :range) going from line '< to line '>. The '<mumble> denotes the mark <mumble> (see :h '). And marks < and > are (surprise!) the first and last lines in a marked region (cf. :h '< and :h '>). Jun 22 '16 at 16:05
  • 2
    is '< supposed to mean something you had the right question, you could have asked it to the doc :h '<
    – statox
    Jun 22 '16 at 16:08
  • 1
    @statox Everything is obvious in hindsight. :) Jun 22 '16 at 16:13
  • 1
    @statox That gives half the answer (that it breaks down into '< and '> as start and end) but the relationship to "marks" (and what exactly marks are) isn't immediately obvious.
    – IMSoP
    Jun 22 '16 at 18:07
  • @SatoKatsura You're probably right... @IMSoP it's maybe not immediately obvious but the '< paragraph is in a chapter called 7. Marks. Anyway OP get a good answer that's the important point :-)
    – statox
    Jun 23 '16 at 7:37

This is actually mark notation. Anytime you go into a visual selection the beginning of the selection is marked with the mark <, and the end with the mark >. You can also do ex-commands between two arbitrary marks that you place yourself. i.e. :'a,'bs/foo/bar/. Vim is just borrowing from the system already in place.

As for what '>,'< would mean. Since we now know this is mark notation, we can see that this would give us a backwards range. (I think vim can sometimes operate on backwards ranges, but it's generally not very happy about them.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.