1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2025-02-05 07:43:22 -08: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!
" au BufWinEnter * call ResCur() " au BufWinEnter * call ResCur()
augroup END 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 endif
" keys/binds {{{1 " keys/binds {{{1