atom feed18 messages in com.googlegroups.vim_useRe: Binary files, noeol, and other su...
FromSent OnAttachments
AaronOct 24, 2006 8:01 am 
A.J.MechelynckOct 24, 2006 8:57 am 
AaronOct 24, 2006 9:06 am 
Yakov LernerOct 24, 2006 9:26 am 
Bram MoolenaarOct 24, 2006 9:27 am 
A.J.MechelynckOct 24, 2006 9:36 am 
AaronOct 24, 2006 9:38 am 
AaronOct 24, 2006 9:51 am 
Gary JohnsonOct 24, 2006 10:08 am 
A.J.MechelynckOct 24, 2006 10:10 am 
Marvin RenichOct 24, 2006 10:11 am 
AaronOct 24, 2006 10:13 am 
AaronOct 24, 2006 10:25 am 
A.J.MechelynckOct 24, 2006 10:35 am 
Matthew WinnOct 25, 2006 3:24 am 
Yakov LernerOct 25, 2006 5:17 am 
VigilOct 26, 2006 2:42 am 
VigilOct 26, 2006 2:49 am 
Subject:Re: Binary files, noeol, and other such things.
From:Gary Johnson (gary@spk.agilent.com)
Date:Oct 24, 2006 10:08:38 am
List:com.googlegroups.vim_use

On 2006-10-24, Aaron <aar@thebailiwick.com> wrote:

A.J.Mechelynck wrote:

yes, that should work if you're dead set on writing a file without a final EOL. You might even automate it further by defining autocommands: let's say that particular filetype is identified by extension .xyz -- then you can define

:autocmd BufWritePre *.xyz setlocal binary :autocmd BufWritePost *.xyz setlocal nobinary

You beat me to it, I was halfway through reading the autocommands help entry when this came through. Thanks, Yakov, for suggesting this.

Here's a thought, though. There is nothing in the file type or filename that will indicate that it is a custom tag, but the file will *always* live in /some/path/custom_tags/myfile.cfm. That's where the CF server will look for custom tags so they have to be there by design.

So perhaps I can do something like:

au BufWritePre *.cfm call MaybeSetBinary() au BufWritePost *.cfm call MaybeUnsetBinary()

fun! MaybeSetBinary() if match(expand('%'),'custom_tags') > -1 setlocal binary endif endfun

fun! MaybeUnsetBinary() if match(expand('%'),'custom_tags') > -1 setlocal nobinary endif endfun

I'll do some experimentation. Thanks again Yakov and Tony.

:autocmd BufWritePre /some/path/custom_tags/myfile.cfm setlocal binary :autocmd BufWritePost /some/path/custom_tags/myfile.cfm setlocal nobinary

See

:help autocmd-patterns

Gary