Edit file on Windows, shows ^M on each line on Linux
Paul Seamons
paul at seamons.com
Fri Apr 13 12:38:46 MDT 2007
> So, a one-line solution for vi(m), and a two page solution for Emacs.
> Sounds about right.
Lets see - emacs:
C-x RET c unix RET
C-x C-v RET
M-% C-q C-m RET RET !
C-x C-s
And now vi:
Well for the first two - Vi doesn't have a way to change visibly between the
two formats to even make the ^M appear - so I guess that doesn't count.
:%s/ C-q C-m //
:w
So VI isn't a one liner - it is at least two - and that is negating the fact
that if the file shows up in DOS mode there isn't an easy way to make the ^M
show up. There might be a way to do this in VI - I haven't been able to find
it.
Well lets try another way of doing things. Turns out we don't need to do
search and replace in Vim or Emacs.
Emacs:
C-x C-f backup.pl
SPC C-_
C-x RET c unix RET
C-x C-s
And now vi:
:set ff=dos
:open backup.pl
:set ff=unix
:w (vim lets us save a file even though we haven't made modifications - emacs
doesn't)
Gee - I'm seeing a pattern here. Both editors are cryptic.
So once again I have written a long document.
I guess that is the difference between emacs and vim users. Vim users give
you a cryptic one liner and hope you know what it is doing, emacs users give
you a cryptic one liner, explain what the one liner does, and then expect
that what they said makes sense.
I'm hoping that this won't fall further into a session of "count the key
strokes that it takes to do it in vim vs emacs because that proves my editor
is culrz." Any such argument is a shallow religious debate about whether it
is better to be in insert mode or control mode.
Paul
More information about the PLUG
mailing list