Sunday, January 23, 2011

Re: dos and no end of file eol?

Hi Marc!

On Sa, 22 Jan 2011, Marc Weber wrote:

> I know about binary, endoffile and ff=dos setting.
>
> Still I get this result:
>
> 61 62 63 0A 61 6F 6E 74 65 68 75
> ^^ no end of file eol. That's ok
> ^^ this is \n where is the \r ?
>
> Is this a bug?
>
> I want Vim to store file the way it got them - so that VCS control
> systems don't show that something changed all lines within a file.
> set binary should be enough. But apparently its not ?

This is probably just a workaround, but wouldn't something like this
work for you?

fun! WriteFilewithoutEOF()
let a=getline(1,line('$')-1)
call map(a, 'v:val . nr2char(13)')
call extend(a, getline('$', '$'))
call writefile(a,fnamemodify(@%, ':p'), 'b')
unlet a
endfun

au BufWriteCmd filename :call WriteFilewithoutEOF()

regards,
Christian

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