1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-09-19 15:04:06 -07:00

allow setting file encoding from modelines

This commit is contained in:
Connor Olding 2024-06-17 20:56:26 -07:00
parent 6e9e2c278f
commit 7ef87b0f88

View file

@ -253,6 +253,17 @@ if has('autocmd')
au!
" au BufWinEnter * call ResCur()
augroup END
function! CheckFileEncoding()
if exists('b:fenc_at_read') && &fileencoding != b:fenc_at_read
exec 'e! ++enc=' . &fileencoding
unlet b:fenc_at_read
endif
endfunction
augroup fenc
au! BufRead *.txt let b:fenc_at_read=&fileencoding
au! BufWinEnter *.txt call CheckFileEncoding()
augroup END
endif
" keys/binds {{{1