On 10/13/11 09:44, Gill, Jack wrote:
Newbie question: Will Vim allow me to batch edit a text file,
forcing characters per line to no more than 90, and placing a
CR/LF at the end of that line?
The short answer is "yes". The more complex answer involves how
you want to wrap (at word-boundaries, or hard at column 90), and
what you mean by "batch edit" (called from an external
shell/batch script, or just "edit a batch of files and perform
this same change on each of them")
For the word-boundary case, you might try:
vim *.txt
:set tw=90 hidden
:argdo norm gggqG
then review the files and
:wall
if you want to save all the changes; otherwise one of the following:
:argdo u
:argdo e!
to undo them all.
If you want to hard-break at 90, even if it happens to fall in
the middle of a word, change the "argdo" line above to
:argdo %s/.\{90}/&\r/g
which drops a newline after every 90 characters.
-tim
--
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