Sunday, December 25, 2011

Re: why is Vim coloring text in txt files?

Thanks Thilo.

I found the Generic configuration code in my C:\Program Files (x86)\Vim
\vim73\filetype.vim
Where in the file should the local configuration code (below) be
placed?

" txt
autocmd BufNewFile,BufRead
\ *.txt,
\*README*
\ setl ft=text

wolfv

On Dec 25, 9:26 am, Thilo Six <T....@gmx.de> wrote:
> wolfv wrote the following on 25.12.2011 16:50
>
> Hello
>
>
>
>
>
>
>
>
>
> > :verbose set filetype?
> > filetype=conf
> >    Last set from C:\Program Files (x86)\Vim\vim73\filetype.vim
>
> > But filetype.vim does not contain a variable named "filetype".
>
> > I added the following line to my vimrc file, which makes the text all
> > black,
> > au BufRead *.txt syntax off
>
> > There is some relevant information on the following links.
>
> > Vim sets the ft (and consequently syn) to "conf" if the file includes
> > a line starting with #
> >http://vim.1045645.n5.nabble.com/How-do-you-disable-syntax-highlighti...
>
> >http://www.cyberciti.biz/faq/turn-on-or-off-color-syntax-highlighting...
>
> ,----[ filetype.vim  ]-----------------------
>
> " Generic configuration file (check this last, it's just guessing!)
> au BufNewFile,BufRead,StdinReadPost *
>         \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
>         \    && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
>         \       || getline(4) =~ '^#' || getline(5) =~ '^#') |
>         \   setf conf |
>         \ endif
>
> `---------------------------------------------
>
> This means when there is a # at the beginning of the first 5 lines AND no other
> filetype has been detected then apply 'ft=conf'.
>
> It seems that i have the following in my local configuration which eliminates
> this default:
>
> ,----[ ~/.vim/ftdetect/filetype.vim   ]-------
>
>   " txt
>   autocmd BufNewFile,BufRead
>       \ *.txt,
>       \*README*
>       \ setl ft=text
> `---------------------------------------------
>
> -- <snip> --
>
> --
> Regards,
> Thilo
>
> 4096R/0xC70B1A8F
> 721B 1BA0 095C 1ABA 3FC6  7C18 89A4 A2A0 C70B 1A8F

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment