Did this file have syntax highlighting on? If so, turn it off.
Dare you provide an example of what the file looks like? As there's
every chance your substitution was wrong to begin with.
-- Thomas Adam
I'd use the standard "tr" utility available on most *nix boxes:
tr ' ' '\n' <in.txt >out.txt
which should be about as fast as it gets (eliminating Vim
altogether).
There are a number of things in Vim that could be causing
slowness: syntax highlighting, paren matching, undo levels, etc.
Dr. Chip maintains a "largefile" script that may help:
http://www.vim.org/scripts/script.php?script_id=1506
-tim
* syntax highlighting
* undo
* checking for autocmd events, and executing associated code when
they're triggered
* swapfile/backup work
* folding
The LargeFile.vim script that Tim mentions turns several of these time
consumers off for "large" files, the definition for which you may
customize by setting the "g:LargeFile" variable.
I don't think LargeFile is switching off paren matching -- that's probably
a good idea (thanks, Tim!) for me to add (a blindspot of mine as I
have paren matching turned off by default, anyway).
Regards,
Chip Campbell
Why such a huge difference in the time taken by two methods? Any
comments? Any way I could have made things faster in the vim method?
***note*** handling a large file
***note*** stopped large file handling
So a :messages command should let you know. Since syntax highlighting
is off for
large file handling its often obvious anyway.
Regards,
Chip Campbell
I haven't had a look at that LargeFile plugin, but I suppose that "large
file mode" status can be checked as a buffer-local boolean expression.
In that case, Googler, it would be possible (for the user, not the
plugin) to set up a custom 'statusline' displaying, let's say, [LF]
after the file name if in Large File mode.
Best regards,
Tony.
--
"Apathy is not the problem, it's the solution"