I use this map and it seems to work well

nmap <unique> <Leader>one :1,$!perl -p -e 's/\r*\n//gm'<CR>

Dont know what the performance is in large files.
\one
is the command to execute it.


drlatex wrote:
> I have a gigantic file (millions of lines long), and I want to make it all
> one line.  There is ONE \n at the end of every line.
>
> The way I have been removing these line breaks is:
>
> 1,$s/\n//
>
> This takes extremely long when $ becomes larger than 15000.  In fact my
> computer runs out of memory.  
>
> I think the problem is that it's searching through thousands of characters
> of "\n"
>
> What might make the situation easier for me is the fact that i KNOW where
> the \n 's are located, so I don't really need to "search" for them. 
> However, I don't know a vim command to remove \n from the end of every line
> (other than the command above).
>
> I should also be able to highlight the \n 's using the visual block (they
> show up yellow on my screen), and remove them by pressing x ... but pressing
> x doesn't seem to do anything to the \n 's ... it only removes non-special
> characters.
>
> Any help is greatly appreciated. Thanks.
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to