2008/10/6 Noah Spurrier <[EMAIL PROTECTED]>:
>
> I put this as the last line in a Python program I'm working on:
> # vim:set sr et ts=4 sw=4 ft=python fenc=utf-8:

fenc cannot be normally used for determining the encoding of the file,
since it is set *after* the file is loaded.  Try opening a file, and
then setting fenc, and you will understand it.

This said, I also think setting fenc in the file is something wanted.
I made this work in the plug-in fencview.  One still needs to remember
that this kind of files may cause trouble to others.  The key function
for this functionality is shown below:

function! s:CheckModelineFileEncoding()
    if &modified && &fileencoding!=''
        if s:disable_autodetection<2
            let Syn=&syntax
            exec 'edit! ++enc='.&fileencoding
            if Syn!=''
                let &syntax=Syn
            endif
        elseif exists('s:fencview_manual_enc')
            let &fileencoding=s:fencview_manual_enc
            set nomodified
        endif
    endif
endfunction

    exec 'au BufWinEnter ' . g:fencview_auto_patterns .
                \' call s:CheckModelineFileEncoding()'

Best regards,

Yongwei

-- 
Wu Yongwei
URL: http://wyw.dcweb.cn/

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to