Created
May 24, 2018 02:09
-
-
Save joongh/f670e4ac2770fa6d9255423a9fb85562 to your computer and use it in GitHub Desktop.
vimrc - Check file encoding before write and change it to what you want
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func! Encode_euckr() | |
" Don't change to euc-kr for these file formats | |
if &ft =~ 'py\|robot\|yaml' | |
return | |
endif | |
if &fileencoding != "cp949" && &fileencoding != "euc-kr" | |
if confirm("File encoding is not euc-kr. Change it?", "&Yes\n&No", 1) == 1 | |
set fileencoding=euc-kr | |
endif | |
endif | |
endfunc | |
autocmd BufWritePre * :call Encode_euckr() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment