Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ddc_vim/deps.ts>op.fileencoding

Dark deno-powered completion framework for neovim/Vim
Go to Latest
variable op.fileencoding
import { op } from "https://deno.land/x/ddc_vim@v4.3.0/deps.ts";
const { fileencoding } = op;

Sets the character encoding for the file of this buffer.

When 'fileencoding' is different from 'encoding', conversion will be done when writing the file. For reading see below. When 'fileencoding' is empty, the same value as 'encoding' will be used (no conversion when reading or writing a file). No error will be given when the value is set, only when it is used, only when writing a file. Conversion will also be done when 'encoding' and 'fileencoding' are both a Unicode encoding and 'fileencoding' is not utf-8. That's because internally Unicode is always stored as utf-8. WARNING: Conversion can cause loss of information! When 'encoding' is "utf-8" or another Unicode encoding, conversion is most likely done in a way that the reverse conversion results in the same text. When 'encoding' is not "utf-8" some characters may be lost!

See 'encoding' for the possible values. Additionally, values may be specified that can be handled by the converter, see mbyte-conversion.

When reading a file 'fileencoding' will be set from 'fileencodings'. To read a file in a certain encoding it won't work by setting 'fileencoding', use the ++enc argument. One exception: when 'fileencodings' is empty the value of 'fileencoding' is used. For a new file the global value of 'fileencoding' is used.

Prepending "8bit-" and "2byte-" has no meaning here, they are ignored. When the option is set, the value is converted to lowercase. Thus you can set it with uppercase values too. '_' characters are replaced with '-'. If a name is recognized from the list for 'encoding', it is replaced by the standard name. For example "ISO8859-2" becomes "iso-8859-2".

When this option is set, after starting to edit a file, the 'modified' option is set, because the file would be different when written.

Keep in mind that changing 'fenc' from a modeline happens AFTER the text has been read, thus it applies to when the file will be written. If you do set 'fenc' in a modeline, you might want to set 'nomodified' to avoid not being able to ":q".

This option can not be changed when 'modifiable' is off.

NOTE: Before version 6.0 this option specified the encoding for the whole of Vim, this was a mistake. Now use 'encoding' instead. The old short name was 'fe', which is no longer used.

(default: "")

type

LocalOption<string>