I am writing an autocmd which will warn me if the file opened is not in UTF-8 format. This is what I have got:
augroup non_utf8_file autocmd! autocmd BufRead * if &fileencoding != 'utf-8' | echomsg 'file not in utf-8 format!' | endif augroup END
Unfortunately, the above autocmd does not work in Neovim when I tried to open a file which is not utf-8 encoded. No message is shown.
But if I open the same file in Vim using the above settings, the warning message is shown correctly.
- Neovim: 0.4.0
- Vim: 7.4