Loading ...
Sorry, an error occurred while loading the content.

22976Re: Vim Regina: tragedy in .5 act

Expand Messages
  • Gary Holloway
    Nov 1, 2001
    • 0 Attachment
      Ok, let me try this again (taking my own suggestion...)

      / FROM: "Austy Garhi (n. d'i-b.)" <tgal@...>, Oct 31 17:10 2001
      | ABOUT: Vim Regina: tragedy in .5 act
      |
      ...
      | try to find help in the helpfiles to answer the user's question
      | "how do i save a `selected` block of text to a new file?" V.g.:
      ...
      |
      \ END: "Austy Garhi (n. d'i-b.)"

      [assuming a visually-selected block]
      You should be able to select the text, and use ":w filename".

      Note that this will write entire, complete lines, starting from the first line
      where the selection starts through the last line containing the selection.

      See help v_:

      How I found this help:
      :help block<tab> (blockwise-visual)

      Scrolling down, you'll find section #4, Operation on the Visual area.

      The first entry under "Additionally the following commands can be used:"
      is:

      : start ex command for highlighted lines (1) |v_:|

      (Here is where it certainly isn't obvious this is what you want...unless
      you're thinking ":w").

      On the far right is a help "tag" where more information can be found on
      this. You can either double-click on the |v_:|, or type :help v_: which
      elaborates, and explains why you would suddenly see ":'<,'>" on your
      command line when you press ":" while there is a visual selection.

      In general, the "intuitive" thing will often do what you'd expect...of course
      not much is intuitive when first learning vim. :(

      i.e.,
      The ":w" is the basic method for writing a file (in it's entirety).

      To write to a different file name, ":w filename" is used.

      To write specific lines, you add a range, e.g.: ":1,20w filename".

      Extrapolating that, if there is a visual block selected, the line number
      range is automatically entered for you, as you enter :w.

      So, that's why I tried :w first, and it worked. The "hard" part (for me too)
      was finding the the help that explains it.

      If you have specific suggestions for improving the help (changes in text,
      for clarity, etc.), please feel free to submit them.

      I know I've spent my fair share of time digging through help looking for some
      thing or another. Rest assured I eventually do find it...so it's all there,
      albeit sometimes burried.

      -gary
    • Show all 19 messages in this topic