[NBLUG/talk] changeing line breaks.

Ron Wickersham rjw at alembic.com
Sun Oct 19 21:29:01 PDT 2003


On Sun, 19 Oct 2003, E Frank Ball wrote:

> On Sun, Oct 19, 2003 at 07:06:16PM -0700, Ron Wickersham wrote:
> }
> } in going the other way, editing a dos file in vi and keeping it in unix,
> } you can do :%s/
> } //g and get rid of all the extra carriage returns.
> } (you get the
> }  above with <cont>V followed by <return>).
>
> What will be visable at the : prompt is this:
>
> :%s/^M//g
>
> Where ^M is <ctrl><Enter>, which is made with
> <ctrl>v <ctrl><Enter>

interesting, it looked ok on a dtterm when i typed it but obviously sent
the x0D in the mail.   i've found that <ctrl>V  is designed to take the next
keystroke as a control character without using the <ctrl> key at the same
time.

i got wondering if <ctrl>V has anything to do with vi or if the shell
is doing the work.  on a couple of different systems i found that sh and
csh both showed the ^ when you type <ctrl>V and the second <ctrl> is not
required, but bash didn't show anything when typing <ctrl>V but then
after typing the second character, then showed both characters.

but in real vi (running in sh and csh) and also in vim (running in bash,
sh, and csh) after entering the : to get to ex the ^ is shown immediately
when typing <ctrl>V.

to further confuse things i've always seen the typographic convention that
<ctrl> is followed by the upper-case version of the key hit while the <ctrl>
key is down and doesn't imply that the shift key is also pressed.  i guess
it's because there aren't any keys with the lower case glyphs printed on
them.  Frank's use of the lower case makes sense but looks unusual to
me.  does HP documentation use the lower case or am i out of it and
things have changed so that either case is used in documentation?

> } vim has some automatic scheme that usually does the right thing for you,
> } but you can force it with :set fileformat unix or :set fileformat dos
> } before you save the file.
>
> vim should also show that it's a dos file at the bottom anytime you edit
> one.

yes, but if you start out with a unix file and want to export it in msdos
format, then it's necessary to force vim to do so, since default is to
save it in the same format as it was originally.

-ron



More information about the talk mailing list