Demonstration:

The code:
Save it @Packages/YourPluginName/YourPluginName.py
import sublime, sublime_plugin
class EventListener( sublime_plugin.EventListener ):
def on_load ( self, view ):
fileExtension = view.window().extract_variables() [ "file_extension" ]
encodingSets = \
{
"log" : "Hexadecimal",
"dump" : "Hexadecimal",
}
if fileExtension in encodingSets:
encoding = encodingSets[ fileExtension ]
view.run_command ( "reopen", { "encoding" : encoding } )
Notes:
I found a command reopen + encodingin This thread and wrapped it in , where you can define key-value pairs of extensions and their associated encodings. on_load EventListener
, reset ctrl + z. , , . , . , ctrl + z, .
:
Sublime Text:
"Hexadecimal"
"UTF-8"
"UTF-16 LE"
"UTF-16 BE"
"Western (Windows 1252)"
"Western (ISO 8859-1)"
"Western (ISO 8859-3)"
"Western (ISO 8859-15)"
"Western (Mac Roman)"
"DOS (CP 437)"
"Arabic (Windows 1256)"
"Arabic (ISO 8859-6)"
"Baltic (Windows 1257)"
"Baltic (ISO 8859-4)"
"Celtic (ISO 8859-14)"
"Central European (Windows 1250)"
"Central European (ISO 8859-2)"
"Cyrillic (Windows 1251)"
"Cyrillic (Windows 866)"
"Cyrillic (ISO 8859-5)"
"Cyrillic (KOI8-R)"
"Cyrillic (KOI8-U)"
"Estonian (ISO 8859-13)"
"Greek (Windows 1253)"
"Greek (ISO 8859-7)"
"Hebrew (Windows 1255)"
"Hebrew (ISO 8859-8)"
"Nordic (ISO 8859-10)"
"Romanian (ISO 8859-16)"
"Turkish (Windows 1254)"
"Turkish (ISO 8859-9)"
"Vietnamese (Windows 1258)"
* Packages\Default\Encoding.sublime-menu *