Vim Recall繁體中文

Encoding used in sourced Vim script

:scriptencoding

Example

Normal 0 / 2

Encoding used in sourced Vim script.

Prepared example.vim

Status
not sourced
Source byte for é
E9 (Latin-1), shown decoded in this illustration

Vim messages

Empty
Before & after

Before

Prepared example.vim

Status
not sourced
Source byte for é
E9 (Latin-1), shown decoded in this illustration

Vim messages

Empty

After

Prepared example.vim

Status
sourced
g:word
café (UTF-8)

Vim messages

café

Subject: :scriptencoding. Documentation-backed illustration; assumes +eval, encoding=utf-8, supported Latin-1 conversion; example.vim is physically encoded Latin-1; current unmodified buffer is saved as example.vim; not replay-verified. The prepared file's é byte is 0xE9. scriptencoding latin1 converts following source lines to the current UTF-8 encoding, so g:word contains café.

Sample buffer
scriptencoding latin1
let g:word = 'café'
echo g:word
Cursor on line 1, column 1
Details & Vim help

Encoding used in sourced Vim script. This Ex reference uses the full command name; the alphabetical index omits arguments. Supply the ranges, arguments, flags and prerequisite state documented in the linked help. Press Enter to submit a complete command. The index spelling :scripte[ncoding] puts the optional abbreviation suffix in square brackets; those brackets are not typed. Availability and exact behavior can depend on Vim build features, options, mappings and editor state; the linked help is authoritative.