On Wed, Feb 27, 2002 at 10:20:57AM +0100, M.-A. Lemburg wrote: > So if we use the RE "coding[=:]\s*([\w-]+)" on the first line, > we should be able to reach out for the encoding, right ? > > This RE would then cover both vim and emacs. I've been informed on a #vim irc channel that "vim:fillencoding=blah:" does not work. Unfortunate. I overlooked the part of the documentation which states To read a file in a certain encoding it won't work by setting 'fileencoding', use the |++enc| argument. However, there's a "charset plugin" for vim: http://vim.sourceforge.net/scripts/script.php?script_id=199 which could be adapted to follow whatever convention is chosen for Python. However, this plugin is not standard in any version of vim. It's not clear what license it's under, but referencing it from the PEP and documenting that something like au BufReadPost *.py ReloadWhenCharset(1, "coding[:=]\s([\w-]+)") au BufReadPost *.py ReloadWhenCharset(2, "coding[:=]\s([\w-]+)") (search the first two lines for the emacs coding special marker) would cause it to detect the charset of a Python file would certainly be possible. The plugin functions by executing a reload of the file with ++enc when ReloadWhenCharset matches its pattern. Jeff
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4