[질문] VIM 에서 BOM 문자열을 안보게 할려면

byung82의 이미지

안녕하세요 ^^;

윈도쪽으로 작업을 하고 있는데 BOM을 없이 저장을 하면 노트패드는 한글이 잘 보이는데 다른 프로그램에서 한글이 깨져서 어쩔수 없이 BOM이 있게 저장을 하고 있는데 이 BOM때문에 몇몇파일은 sytanx가 표현이 되지 않습니다.

어떻게 하면 BOM을 표시 하지 않으면서 BOM으로 저장된 UTF-8파일을 읽을수 있는지 답변 부탁드리겠습니다.

하나더 추가적으로 vim에서 BOM이 달린 UTF-8로 저장을 할려면 어찌 해야 하는지도 답변 부탁드리겠습니다.

송효진의 이미지

제 설정인데 확인을 안해봐서 될런지 모르겠네요.

" {{{ Locale settings
" Try to come up with some nice sane GUI fonts. Also try to set a sensible
" value for fileencodings based upon locale. These can all be overridden in
" the user vimrc file.
if v:lang =~? "UTF-8$"
  set fileencodings=utf-8
  set fileencoding=utf-8
else
  set fileencodings=
endif

if v:lang =~? "^ko"
  set fileencodings+=euc-kr
  if &fileencodings !~? "utf-8"
    set fileencoding=euc-kr
  endif
  set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-*
elseif v:lang =~? "^ja_JP"
  set fileencodings+=euc-jp
  if &fileencodings !~? "utf-8"
    set fileencoding=euc-jp
  endif
  set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*
elseif v:lang =~? "^zh_TW"
  set fileencodings+=big5
  if &fileencodings !~? "utf-8"
    set fileencoding=big5
  endif
  set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-1,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0
elseif v:lang =~? "^zh_CN"
  set fileencodings+=gb2312
  if &fileencodings !~? "utf-8"
    set fileencoding=gb2312
  endif
  set guifontset=*-r-*
endif

" If we have a BOM, always honour that rather than trying to guess.
if &fileencodings !~? "ucs-bom"
  set fileencodings^=ucs-bom
endif

" Always check for UTF-8 when trying to determine encodings.
if &fileencodings !~? "utf-8"
  set fileencodings+=utf-8
endif

" Make sure we have a sane fallback for encoding detection
set fileencodings+=default