用于影响htmldjango的python的Vim文件类型设置

时间:2016-12-15 18:12:47

标签: python django vim django-templates

我的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

但问题是相同的设置应用于htmldjango类型的文件,这些文件是django的模板文件。

我也在我的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

我能做些什么来阻止它呢? 感谢

1 个答案:

答案 0 :(得分:0)

您可以告诉autocmd手动忽略html文件。

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

基于this answer