3

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.

4 Answers 4

11

'< 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.

4
  • By shape I meant: current-word, current-line, current-paragraph, etc. Mar 20, 2013 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, 2013 at 17:32
  • 1
    @luserdroog, I think that :h motion.txt will trully blow your mind.
    – romainl
    Mar 20, 2013 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. Mar 21, 2013 at 2:26
6

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?

2
  • 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, 2013 at 16:52
  • all kinds of things.. are a bit to vast.:D but good help info hint.
    – Kent
    Mar 20, 2013 at 16:59
1

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

-1

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.

1
  • This is wrong. See below answer by @Kent
    – Dav Clark
    Mar 20, 2013 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .