How to let vim show BOM as <feff> -
when @ file on 1 of our servers see this:
<feff>sku;qty productsku;1
when download file , open vi don't see <feff>
when :e ++bin
can see <feff>
see ^m now
<feff>sku;qty^m productsku;1^m
but don't want set ^m
. want see <feff>
. example <80>
had in file.
how can set vim show me special chars?
~ edit ~
the command vi --version
tells me following:
vim - vi improved 7.0 (2006 may 7, compiled aug 4 2010 07:21:08)
it says system-vimrc-file /etc/vimrc
has following content:
if v:lang =~ "utf8$" || v:lang =~ "utf-8$" set fileencodings=utf-8,latin1 endif set term=builtin_ansi set nocompatible " use vim defaults (much better!) set bs=indent,eol,start " allow backspacing on in insert mode "set ai " set autoindenting on "set backup " keep backup file set viminfo='20,\"50 " read/write .viminfo file, don't store more " 50 lines of registers set history=50 " keep 50 lines of command line history set ruler " show cursor position time " part when compiled support autocommands if has("autocmd") augroup redhat " in text files, limit width of text 78 characters autocmd bufread *.txt set tw=78 " when editing file, jump last cursor position autocmd bufreadpost * \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe "normal! g'\"" | \ endif augroup end endif if has("cscope") && filereadable("/usr/bin/cscope") set csprg=/usr/bin/cscope set csto=0 set cst set nocsverb " add database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed environment elseif $cscope_db != "" cs add $cscope_db endif set csverb endif " switch syntax highlighting on, when terminal has colors " switch on highlighting last used search pattern. if &t_co > 2 || has("gui_running") syntax on set hlsearch endif if &term=="xterm" set t_co=8 set t_sb=^[[4%dm set t_sf=^[[3%dm endif
i copied , added ~/.vimrc
none of these changes want. few things in if cases might have play around these too.
does know if there other files 1 stated in vi --version
read when editing file?
:help 'bomb'
explains vim's behavior:
when vim reads file , 'fileencodings' starts "ucs-bom", check presence of bom done , 'bomb' set accordingly. unless 'binary' set, removed first line, don't see when editing.
so,
:set fencs-=ucs-bom
would turn off, encoding detection broken, too! according experiments, explicit encoding setting (via :edit ++enc=ucs2-le
) sets 'bomb'
, removes <feff>
mark. so, avenue leads nowhere.
alternatives
- editing in binary mode, you've found out. wouldn't recommend it, since has drawbacks.
- including indication in statusline. have somewhere else, it's visible, not @ beginning of document. highly recommended right way™ in vim. , easy achieve, too:
set statusline+=\ %{&bomb?'bom':''}
Comments
Post a Comment