Sunday, March 17, 2019

Re: Keeping endofline representation in xml fileformat dos file

Le samedi 16 mars 2019 00:05:26 UTC+1, Christian Brabandt a écrit :
> On Fr, 15 Mär 2019, nivaemail@gmail.com wrote:
>
> > Fails because I don't see mixed end of lines.
>
> If you don't see mixed end of lines, chances are that your Vim is
> handling it correctly. Simply write the file in the fileformat that you
> need (using the +ff=unix or ++ff=dos argument.
>
> Else, please provide a complete example of what works, what you expect
> and what did not work.
>
> Best,
> Christian
> --
> Frauen möchten ohne warum und wofür geliebt werden. Nicht weil sie
> hübsch, liebenswert, wohlerzogen, anmutig oder intelligent sind,
> sondern einfach nur weil sie sie selbst sind.
> -- Henri Frédéric Amiel


In order to keep mixed line endings and get all lines in jsut One Inline as opened, here is a steps I wrote:

In register @o is the initial line foobar^Mbar^M^Mfoo^Mbarbarfoofoo


" (1) make it a Dos file
let s:tmpfile = tempname()
sp | exe 'e +ff=dos '.s:tmpfile

" further editing
put=@o

%s/^M/^M/g
w! | bw! " save it


" (2) make it a Unix file
sp | exe 'e +ff=dos '.s:tmpfile
setlocal ff=unix

" further editing
set ft=vb
norm gg=G
w! | bw! " save it

" (3) keep mixed line endings
sp | exe 'e +ff=dos '.s:tmpfile
" further editing
set ft=vb
w! " save it

and then before replacing initial line by modified line

" (4) paste modified line in place of original line
1,1d

" reload
Chars inline
1,$-1s/$/\^M/
%j
%s/^M /\^M/g

" copy the only inline with mixed endings and ^M appearing
norm ^v$hy

" return to original buffer at prev saved cursor pos
wincmd p
call setpos('.', s:cursorpos)


" inject modified inline with mixed endings ^M appearing.
norm f"p
norm lvt"d
norm ^


Best Regards
NiVa

--
--
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@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment