vint
vint copied to clipboard
Spurious scriptencoding error when checking multiple files
The warning "Set encoding before setting scriptencoding (see :help :scriptencoding)" is reported when a set encoding=
is found in any file after :scriptencoding
To reproduce:
- Create a file
dir1/file1.vim
with the following:
set encoding=utf-8
scriptencoding utf-8
- Create a file
dir2/file2.vim
with the following:
set encoding=utf-8
- run
vint dir1/ dir2/
Expected result: no error Actual result:
dir2/file2.vim:1:1: Set encoding before setting scriptencoding (see :help :scriptencoding)
Hi there, I can confirm that I'm seeing this issue with vint 0.4a3 on my .vim directory (it actually contains my vimrc file)
my vimrc sets encoding first and then scriptencoding. there's one more file that sets scriptencoding and that causes the error to show up
Workaround:
policies:
ProhibitEncodingOptionAfterScriptEncoding:
enabled: false
Hi there, I can confirm that adding the snippet of configuration that @offa mentioned to ~/.vintrc.yaml
takes out the error about the encoding.
It also takes out all legit checks for this within files though.
The way I worked arount this issue was to modify my ~/.vimrc
in this way to disable the warning only where the error was being produced:
" vint: -ProhibitEncodingOptionAfterScriptEncoding
set encoding=utf-8
scriptencoding utf-8
" vint: +ProhibitEncodingOptionAfterScriptEncoding
I just use my fork which includes the fix https://github.com/Vimjas/vint/pull/364