136825Re: Replacing CRLF
- Mar 20, 2013On 2013-03-20, george gutman wrote:
> On Sat, Feb 16, 2013 at 4:20 AM, Jerry Rocteur wrote:To start with, Ctrl-V is the traditional character used to quote
>> Hi George,
>> On 16 Feb 2013, at 07:03, George Gutman wrote:
>>> I'm using Vim under Windows (XP and 7). I would like to universally
>>> replace text which includes a CRLF with some other text. In MSWord I can
>>> represent CRLF as ^p, but MSWord unfortunately does not behave well with
>>> the large files I'm working with. So how can I do this in Vim?
>> When you're in vi or vim, put yourself in insert mode and then type CTRL V
>> Once you've typed CTRL V you can now type and control character, such as
>> CTRL M or CTRL L
>> CTRL M is carriage return
>> CTRL L is line feed
> Just got back to this issue... I actually had gotten this advice from Mr.
> Google, but it doesn't work for me, if I go into insert mode and type CTRL V,
> all that happens is that the contents of the Windows scrap get pasted at the
> position of the cursor. (I think I also replied on the group, but I'm not sure
> if it was successful...).
special characters such as control characters. Because Windows uses
Ctrl-V for pasting, Vim is often configured on Windows to use Ctrl-Q
where it would normally use Ctrl-V. See
That said, replacing CRLF is a whole other problem. CRLF is the
DOS/Windows EOL sequence. Vim treats EOL sequences specially. They
usually don't even appear in a buffer. How you treat them depends
on what you want to do with them.
If you have a file with only CRLF line endings and all you want to
do is convert them to LF line endings, Vim can do that
automatically. Vim will open that file as 'fileformat' "dos". You
won't see any CRLFs in the buffer. Simply
and the file will be saved with LF (Unix) line endings.
If you have a file that contains a mixture of CRLF and LF line
endings, Vim will load that file as 'fileformat' "unix", hide all
the LFs at the line endings, and show the CRs as ^M. You can delete
all those ^Ms either by executing
where ^Q and ^M are Ctrl-Q and Ctrl-M, respectively, or by executing
If none of that works for you, come back with a more specific
explanation of what you are trying to do and we'll help you with the
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
For more options, visit https://groups.google.com/groups/opt_out.
- << Previous post in topic