{"id":19978752,"url":"https://github.com/s3rvac/autofenc","last_synced_at":"2025-05-04T04:32:04.768Z","repository":{"id":16642103,"uuid":"19397390","full_name":"s3rvac/AutoFenc","owner":"s3rvac","description":"A Vim plugin to automatically detect and set file encoding when opening a file.","archived":false,"fork":false,"pushed_at":"2023-10-29T08:33:36.000Z","size":29,"stargazers_count":27,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T03:02:21.643Z","etag":null,"topics":["detection","encoding","vim"],"latest_commit_sha":null,"homepage":null,"language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/s3rvac.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-03T06:45:06.000Z","updated_at":"2023-11-05T19:38:26.000Z","dependencies_parsed_at":"2024-11-13T03:45:33.808Z","dependency_job_id":null,"html_url":"https://github.com/s3rvac/AutoFenc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3rvac%2FAutoFenc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3rvac%2FAutoFenc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3rvac%2FAutoFenc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s3rvac%2FAutoFenc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s3rvac","download_url":"https://codeload.github.com/s3rvac/AutoFenc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252288912,"owners_count":21724323,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detection","encoding","vim"],"created_at":"2024-11-13T03:35:11.765Z","updated_at":"2025-05-04T04:31:59.751Z","avatar_url":"https://github.com/s3rvac.png","language":"Vim Script","funding_links":[],"categories":[],"sub_categories":[],"readme":"AutoFenc\n========\n\nA Vim plugin that tries to automatically detect and set file encoding when\nopening a file.\n\nDescription\n-----------\n\nThis Vim plugin tries to automatically detect and set file encoding when\nopening a file. It does this in several possible ways, depending on the\nconfiguration.\n\nThe following methods are implemented. When a method fails, the plugin tries\nthe next one.\n\n1. detection of BOM (byte-order-mark) at the beginning of the file, only for\n   some multibyte encodings\n2. HTML way of encoding detection (via the `\u003cmeta\u003e` tag), only for HTML-based\n   file types\n3. XML way of encoding detection (via the `\u003c?xml ... ?\u003e` declaration), only for\n   XML-based file types\n4. CSS way of encoding detection (via `@charset 'at-rule'`), only for CSS files\n5. checks whether the encoding is specified in a comment (like `# Encoding:\n   latin2`), for all file types\n6. tries to detect the encoding via the specified external program (the default\n   one is [enca](https://github.com/nijel/enca)), for all file types\n\nIf the autodetection fails, it is up to Vim and your configuration to set the\nencoding.\n\nInstallation\n------------\n\nThe recommended way of installing this plugin is by using\n[Pathogen](https://github.com/tpope/vim-pathogen).\n\nIf you cannot use Pathogen or you want to install this plugin manually, just\nput the `plugin/AutoFenc.vim` file into your `$HOME/.vim/plugin` directory\n(Linux-like systems) or `%UserProfile%\\vimfiles\\plugin` folder (Windows\nsystems).\n\nConfiguration Options\n---------------------\n\nThe plugin has the following configuration options. You can set them in your\n`$HOME/.vimrc` file.\n\n- `g:autofenc_enable` (0 or 1, default 1)\n\n  Enables/disables this plugin.\n\n- `g:autofenc_emit_messages` (0 or 1, default 0)\n\n  Emits messages about the detected/used encoding or warnings upon opening a\n  file.\n\n- `g:autofenc_max_file_size` (number \u003e= 0, default 10485760)\n\n  If the size of a file is higher than this value (in bytes), then the\n  autodetection will not be performed.\n\n- `g:autofenc_disable_for_files_matching` (regular expression, see the settings\n  in `plugin/AutoFenc.vim`)\n\n  If the file (with complete path) matches this regular expression, then the\n  autodetection will not be performed. It is by default set to disable\n  autodetection for non-local files (e.g. accessed via ftp or scp) because the\n  script cannot handle some kind of autodetection for these files. The regular\n  expression is matched case-sensitively.\n\n- `g:autofenc_disable_for_file_types` (list of strings, default `[]`)\n\n  If the file type matches some of the filetypes specified in this list, then\n  the autodetection will not be performed. The comparison is done\n  case-sensitively.\n\n- `g:autofenc_autodetect_bom` (0 or 1, default 0 if `ucs-bom` is in\n  `fileencodings`, 1 otherwise)\n\n  Enables/disables detection of encoding by BOM.\n\n- `g:autofenc_autodetect_html` (0 or 1, default 1)\n\n  Enables/disables detection of encoding for HTML-based documents.\n\n- `g:autofenc_autodetect_html_filetypes` (regular expression, see the settings\n  in `plugin/AutoFenc.vim`)\n\n  Regular expression for all supported HTML file types.\n\n- `g:autofenc_autodetect_xml` (0 or 1, default 1)\n\n  Enables/disables detection of encoding for XML-based documents.\n\n- `g:autofenc_autodetect_xml_filetypes` (regular expression, see the settings\n  in `plugin/AutoFenc.vim`)\n\n  Regular expression for all supported XML file types.\n\n- `g:autofenc_autodetect_css` (0 or 1, default 1)\n\n  Enables/disables detection of encoding for CSS documents.\n\n- `g:autofenc_autodetect_css_filetypes` (regular expression, see the settings\n  in `plugin/AutoFenc.vim`)\n\n  Regular expression for all supported CSS file types.\n\n- `g:autofenc_autodetect_comment` (0 or 1, default 1)\n\n  Enables/disables detection of encoding in comments.\n\n- `g:autofenc_autodetect_commentexpr` (regular expression, see the settings in\n  `plugin/AutoFenc.vim`)\n\n  Pattern for detection of encodings specified in a comment.\n\n- `g:autofenc_autodetect_num_of_lines` (number \u003e= 0, default 5)\n\n  How many lines from the beginning and from the end of the file should be\n  searched for the possible encoding declaration.\n\n- `g:autofenc_autodetect_ext_prog` (0 or 1, default 1)\n\n  Enables/disables detection of encoding via an external program (see\n  additional settings below).\n\n- `g:autofenc_ext_prog_path` (string, default `'enca'`)\n\n  Path to the external program. It can be either a relative or absolute path.\n  The external program can take any number of arguments, but the last one has\n  to be a path to the file for which the encoding is to be detected (it will be\n  supplied by this plugin). The output of the program has to be the name of the\n  encoding in which the file is saved (a string on a single line).\n\n- `g:autofenc_ext_prog_args` (string, default `'-i'`)\n\n  Additional program arguments (can be none, i.e. `''`).\n\n- `g:autofenc_ext_prog_unknown_fenc` (string, default `'???'`)\n\n  If the output of the external program is this string, then it means that the\n  file encoding was not detected successfully. The string has to be\n  case-sensitive.\n\n- `g:autofenc_enc_blacklist` (regular expression, default `''`)\n\n  If the detected encoding matches this regular expression, it will be ignored.\n\nNotes\n-----\n\nThis script is by all means NOT perfect, but it works for me and suits my needs\nvery well, so it might be also useful for you. Your feedback, opinion,\nsuggestions, bug reports, patches, simply anything you have to say is welcomed!\n\nThere are similar plugins to this one, so if you do not like this one, you can\ntest these:\n\n* [FencView.vim](http://www.vim.org/scripts/script.php?script_id=1708):\n     Mainly supports detection of encodings for asian languages.\n* [MultiEnc.vim](http://www.vim.org/scripts/script.php?script_id=1806):\n     Obsolete, merged with the previous one.\n* [charset.vim](http://www.vim.org/scripts/script.php?script_id=199):\n     Not very complete/correct and last update in 2002.\n* [Detect encoding from the charset specified in HTML\n  files](http://vim.wikia.com/wiki/Detect_encoding_from_the_charset_specified_in_HTML_files):\n     Same basic ideas but only for HTML files.\n\nLet me know if there are others and I will add them here.\n\nLicense\n-------\n\nCopyright (c) 2009-2016 Petr Zemek \u003cs3rvac@petrzemek.net\u003e\n\nDistributed under GNU GPLv2:\n\n    This program is free software: you can redistribute it and/or modify it\n    under the terms of the GNU General Public License as published by the Free\n    Software Foundation, either version 2 of the License, or (at your option)\n    any later version.\n\n    This program is distributed in the hope that it will be useful, but WITHOUT\n    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n    FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n    more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program. If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs3rvac%2Fautofenc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs3rvac%2Fautofenc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs3rvac%2Fautofenc/lists"}