This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: vi


Robert --

...and then Robert Mark Bram said...
% 
% Howdy all!

Hiya!


% 
% I am still a great fan of my gui text editor, Ultraedit, but I am trying to
% get to know vi so I can truly compare them.

I've heard nice things about UE, but truly there is nothing like vi.
Unfortunately, it's probably one of those things that you'll either love
or hate; there's no middle ground :-)


% 
% I found this about copy in vi's help system:

BTW, you're actually looking at vim, which is a souped-up (ahem,
IMproved) version of vi.  You can learn much more about it at vim.org
and also browse the mailing lists to see some discussion of features.
But I digress...


% 
% :[range]co[py] {address}                                *:co* *:copy*
%                         Copy the lines given by [range] to below the line
%                         given by {address}.
% 
% Does the address refer to a line number here? Is there a way turn line
% numbers on?

There sure is.  Just type one of

  :set nu
  :set numbers

when in command mode (and "nonu" or "nonumbers" to turn them off).


% 
% Does vi allow for a simple copy/cut and paste?

Yes and no...  The vim that you're running is the console version, so
you'd be using the console windowing support to do so if you wanted to
use the mouse.  You could compile up your own version of vim and have the
GUI version, gvim, as well (I'd like to know why this isn't in the cygwin
version but haven't done any reading and thus haven't posed the question,
but since it's come up... :-)

There is "yanking" in vi, which accomplishes what you want within the vi
buffer buanking" in vi, which accomplishes what you want t doesn't put
the data on the system clipboard.  To yank a line, type 'yy'; to yank ten
lines, type '10yy'; to yank ten lines into buffer a type '"a10yy'.  To put
your yanked lines, go to your destination and type 'p'; to put the lines
from buffer a, type '"ap'.

Since you're running vim, see lots more with

  :help yank

and have fun :-)

I believe that gvim now has support for specified-width copying (like
grabbing a block of columns 14 thru 30 on lines 3 thru 10) but haven't
played with it enough to know what to set or even if my understanding is
accurate.  More on the vim list, I'm sure.


% 
% I read the section for wrap too - so I can turn wrapping on and off easily,
% but it didn't make sense to me. How do I turn this option on and off?

Setting a wrapmargin or a textwidth means that really long lines, like I've specifically made this one, are broken for you as you type.

You set them by typing

  :set wm 8

to back off 8 chars from the right edge of your screen or

  :set tw 72

to set your width to 72 no matter what size your screen is.  As before,
you can use the long or short names interchangeably.

If you have a paragraph that now looks funny because you had tw set
and then you went back and added some text in the middle and now your
edges are really messed up, kind of like
this demo paragraph, you can use the vim function "gq" (which has lots
and lots of options) to reformat your
paragraph.  If you're running stock vi, you'll have to use something
like fmt or par called from a macro; my .exrc has

  map f !} fmt -c
  map F !} fmt -c -w 78

in it for just that purpose (in command mode I can hit 'f' to format the
paragraph from my cursor down, while 'F' formats it extra-wide to perhaps
squeeze up a very short line).

All of these options, which you set with a 

  :set

command in the editor, can be set in your .exrc or .vimrc file by
leaving off the : part and just typing in the setting, as I did for 
my fmt mappings (which would be ":map ..." interactively).


% 
% Thanks for any help!

HTH & HAND & as they say on the other list Happy Vimming


% 
% Rob
% 
% :)
% :-}
% ;->


:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) davidtg@justpickone.org * than to live up to them. -- fortune cookie
(work) davidtgwork@justpickone.org
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg00067/pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]