Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I fumbled in vi and briefly saw this at the bottom of the screen, just as I was hitting ESC:

:'<,'>

Like it was ready for me to type an arbitrary ed command over a range spanned by the marks '< and '>. What's it called? What's the keystroke? And is there additional magic to set '< and '> to convenient locations?

Apology. I did try searching google with "vim < > mark" and got inundated with html-related stuff. I did not try "vim :'<,'>", as I now realize I ought to have done. I did try :h < and :h > but not :h '< nor :h '> which would have led me to the answer.

But there must be others that haven't learned this, yet. I hope this question remains undeleted even if it must be closed.

share|improve this question

migrated from stackoverflow.com Mar 21 '13 at 2:16

This question came from our site for professional and enthusiast programmers.

4 Answers 4

up vote 10 down vote accepted

'< and '> are marks corresponding to the beginning and end of a visual selection.

Separated by a , they form a range that is inserted automatically for you when you hit : while in visual mode. That way, you can execute an Ex command (like s or d) against the selected lines without having to type the range yourself. Handy!

And the best part is that they are still there if you leave visual mode: the next :'<,'>command will work on the same part of the buffer and you can use '< and '> in normal mode to jump around. Until the next visual selection, of course.

See :h motion.txt for more awesomeness.

As for the "shape" part of your question… I have no idea what you mean.

share|improve this answer
    
By shape I meant: current-word, current-line, current-paragraph, etc. –  luser droog Mar 20 '13 at 17:14
    
@luserdroog '<,'> doesn't work for current word, current line...hum...you could directly type :, it makes no sense for your "current line". current paragraph, you could vip then type :. Oh, I just found that, vip :D –  Kent Mar 20 '13 at 17:32
1  
@luserdroog, I think that :h motion.txt will trully blow your mind. –  romainl Mar 20 '13 at 18:23
    
Visual selection is astounding enough. I was able to make my nice answer even nicer. ... And I'm very relieved that this question was migrated when perilously close to closure. They say a good answer saves a bad question, so it's all you, buddy. You're my hero. Thanks a million. +1 again. –  luser droog Mar 21 '13 at 2:26

if you do:

:h '<

you got:

'<  `<          To the first line or character of the last selected
            Visual area in the current buffer.  For block mode it
            may also be the last character in the first line (to
            be able to define the block).  {not in Vi}.

usually it happened when you visual selected something and typed : so that you want to enter a command to handle selected lines. You can just press ctrl-c to exit command line mode.

Is that what you want to know?

share|improve this answer
    
To more fully answer, you can type all kinds of things as ranges at the beginning of a : prompt. See :h cmdline-ranges –  Dav Clark Mar 20 '13 at 16:52
    
all kinds of things.. are a bit to vast.:D but good help info hint. –  Kent Mar 20 '13 at 16:59

v-motions will visually select, then : will bring up ed command

share|improve this answer

I think that was just the escape charecter attempting to print itself on your screen. If you are looking for commands in vi(m) to do that, look at the vim cheat sheet at Tuxfiles.org. If you want to use ed in windows, you can either use it in vim from the command on the cheat sheet, install it via the cygwin installer, or use the Gnuwin32 ed.

share|improve this answer
    
This is wrong. See below answer by @Kent –  Dav Clark Mar 20 '13 at 16:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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