# :'<,'> Vs :'>,'>, what do these range arrows in vi visual mode mean?

I am trying to copy the selected text from vim into system clipboard.

In visual mode, i pressed :, and the command prompt string changed as, :'<,'> Running

:'<,'> !tee >(xsel -b)


added :'<,'> into the current buffer which is not the desired result.

Then i edited the command prompt string and ran it as, :'>,'> !tee >(xsel -b)

Selection area got copied into clipboard.

How is :'>,'> different from :'<,'>?

Original question

The '< and '> symbols mark the beginning and end of the last selected Visual area. For commands that take a range of lines or characters, '<,'> means that the range of the command is the selected area.

jjaderberg suggests that the '>,'> range expression following a Visual selection would mean that the last line of the selection alone constitutes the range that the filter works on. AFAICT, this is the case.

As for why the '<,'> range failed in that way, I'm sorry to say I have no idea. I haven't been able to reproduce it. If anyone knows, please edit this answer.

Documentation:

• The '< / '> symbols: :h '<
• Using a range with a filter: :h range!
• Beginning a command-line with a Visual Line selection: :h v_:
• there was a space before !. it is like, :'<,'> !tee >(xsel -b) – Madhavan Jul 29 '15 at 16:56
• @MadhavanKumar: you can have spaces between the range and the command. – Peter Lewerin Jul 29 '15 at 16:57
• Are you sure you're not mixing up "!-filter" and "!-command"? See :help ! and :help :!. Filter takes a range (:help :range!). I don't understand why one would use '>,'> for a range, however, or how this particular command is supposed to work. – jjaderberg Jul 29 '15 at 17:12
• @jjaderberg: yes, I did, thank you for pointing that out. I thought something looked off when I wrote that paragraph, but I didn't think to look at :h range!. I'll put on my thinking hat again. – Peter Lewerin Jul 29 '15 at 17:24
• Well the question is about visual selection marks and you have partially answered that. What I don't understand is how '>,'>, ie "from last line of last visual selection to last line of last visual selection", can work for OP. Strictly the answer is "The one selects from beginning to end of last visual selection, the other from end to end", so if you add that and references to relevant help topics you have answered the question. If your thinking hat yields result I'd be interested to know how/why OPs command works. – jjaderberg Jul 29 '15 at 17:50