Trans said:
I use vi/vim for quick/light editing. But I don't understand how others
use it as their main editor. And I don't say this lightly: I even
bought a book on using vi/vim. Yet I still often hear how "wonderous"
it is if one does.
So tell me this, how does one copy and paste without counting lines?
Using n+yy & p (where n is some number) for a few lines is okay, but
beyond that...
Thanks
T.
In pure vi, I usually set a mark on the first line I like to copy, with
mm (it remembers the position in register 'm'), go to the last line and
do y'm. Then you can paste it wherever you want with p.
In vim, there's a visual mode, where you can visually select text
(selected characters are displayed in reverse video) and then choose any
command to work on selected text, for example Vjjjy yanks 3 lines down
the current cursor position, displaying those lines in reverse video
along the way. Of course you can use more complex movement commands with
visual mode. You can also choose between character selection (v), line
selection (Shift-v) or column selection (Ctrl-v) to start visual mode.
Gennady.
P.S. I do use vi/vim as my main (and only) editor for everyday C++,
Ruby, etc. development for the last 10 years. And I am totally happy
with it ;-).