Thursday, March 4, 2010

Vim and Mac to Unix and CR to LF

 
How do you translate a CR
to a LF? How to your translate
a Classic Mac text file to Unix?

Here's a simple command that will
do this:

:%s/\r/\r/g

Here's where I learned how to do
this:

Change end-of-line format for dos-mac-unix

Ed Abbott

Insert an ASCII Character With Vim

 
Vim is a handy tool for inserting
an ASCII character into a file. Of
course, most characters are easily
entered by just simply typing them.

For example, Capital-A is
entered into a file by typing a
Capital-A while in Insert Mode.
It's easy to enter a number, a character
of the alphabet, or punctuation.

In life, it is often helpful to have
more than one way to get there. If
a landslide has blocked one road, you
can use another.

In Vim, the alternative way to insert
an ASCII character is to type CNTRL-V
while in insert mode. This will cause you
to be prompted for the ASCII code for
that character.

You terminate the prompt but either typing
something other than a number or by hitting
the ESC key. After you've terminated the
prompt, the character, whose ASCII code you
just typed, appears.

Ed Abbott