Encoding used in sourced Vim script
Example
Normal 0 / 2Command-line 1 / 2Normal 2 / 2Encoding 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
Command entered · ready to apply
Prepared example.vim
- Status
not sourced- Source byte for é
E9 (Latin-1), shown decoded in this illustration
Vim messages
Empty
The prepared file's é byte is 0xE9. scriptencoding latin1 converts following source lines to the current UTF-8 encoding, so g:word contains café.
Prepared example.vim
- Status
sourced- g:word
café (UTF-8)
Vim messages
café
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é.
scriptencoding latin1
let g:word = 'café'
echo g:wordCursor on line 1, column 1Details & 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.