Wednesday, September 29, 2010

Re: Arbitrary ends of lines?

On 09/29/10 13:07, Benjamin R. Haskell wrote:
> I'm dealing with some file formats that have data segments terminated by
> an arbitrary segment terminator (in this case '#'). Is there built-in
> functionality for dealing with situations like this?
>
> It'd be nice to be able to treat this like a 'ff'.
> ff=unix =<NL>
> ff=dos =<CR><NL>
> ff=mac =<CR>
> ff={anything-else} = custom line terminator
>
> Since that currently doesn't exist, though, is there a plugin to do
> roughly what that would accomplish?

I don't know of a plugin, but shooting from the hip, I'd be
tempted to use "tr" as a filter like xxd[1] is used for binary files:

tr '#\012' '\012#'

will swap newlines and "#" signs, which can then be reversed upon
writing to get the originals back.

-tim


[1]
:help using-xxd
for examples on setting up the autocmd entries

--
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

No comments: