简体   繁体   中英

Vim filetype settings for python affecting htmldjango also

I have the following settings in my vimrc

let python_highlight_all=1
augroup vimrc_autocmds
   autocmd!
    autocmd FileType python highlight Excess ctermbg=DarkGrey guibg=Black
    autocmd FileType python match Excess /\%80v.*/
    autocmd FileType python set nowrap
augroup END

but the problem is that the same settings are applied to files of type htmldjango which are template files of django .

i have set the following parameters also in my vimrc

set hidden
set number
set nowrap
set autochdir  
set splitbelow
set splitright
set nocompatible
set foldmethod=indent
set foldcolumn=3
set nofoldenable 
set tabstop     =4
set shiftwidth  =4
set softtabstop =4
set expandtab
set pastetoggle=<F5>
set laststatus=2
set encoding=utf-8
let s:vim_home ='/home/xxxxx/.vim'
set scrolloff=3
set autoindent
set smartindent
set confirm
set visualbell
set history=1000
set showmatch
set incsearch
set hlsearch
set ignorecase
set smartcase
set mouse=a
set showcmd
set ruler
set nobackup
set writebackup
execute('set backupdir='.s:vim_home.'/backup')
execute('set directory='.s:vim_home.'/temp')
set wildmenu
set wildmode=list:longest
set wildignore+=.DS_Store,Thumbs.db
set wildignore+=*.so,*.dll,*.exe,*.lib,*.pdb
set wildignore+=*.pyc,*.pyo
set wildignore+=*.swp"
set backspace=indent,eol,start
set whichwrap+=<,>,h,l
set listchars=eol:$,tab:>-,trail:-,extends:>,precedes:<,nbsp:%,conceal:.
set complete=.,w,b,u,t
set completeopt=longest,menuone,preview
filetype    plugin indent on
syntax      on
colo        molokai

what can i do to prevent it?
Thanks

You can tell autocmd to ignore html files manually.

let blacklist = ['html']
autocmd FileType python if index (blacklist, &ft) < 0 | highlight Excess ctermbg=DarkGrey guibg=Black
autocmd FileType python if index (blacklist, &ft) < 0 | match Excess /\%80v.*/
autocmd FileType python if index (blacklist, &ft) < 0 | set nowrap

Based on this answer .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM