DervishD wrote:

>     Hi all, and sorry for self-replying...
> 
>  * DervishD <[EMAIL PROTECTED]> dixit:
> > > >I want to edit/view utf8 files *and* I don't want new files or
> > > >US-ASCII files to be considered utf8, my best bet is to use
> > > >"BufReadPre" to detect utf8 files using "file -i" or something
> > > >similar, thus forcing the conversion, am I wrong?
> 
>     I've done the following autocommand to perform the detection:
> 
> autocmd BufReadPre *
>     \ if system("file -i " . expand("<amatch>")) =~ "utf8" |
>     \   setlocal fenc=utf8 |
>     \ endif
> 
>     I'm sure that it could be much more simpler and powerful, but I'm a
> newbie programming in VimL, so... It works for me, at least, but any
> suggestion is welcome.

Did you set 'fileencodings' to an empty string?  Otherwise this would
not work.

-- 
My sister Cecilia opened a computer store in Hawaii.
She sells C shells by the seashore.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to