Some scripts in $VIMRUNTIME/ftplugin/
(e.g. python.vim
and ada.vim
) do not define b:undo_ftplugin
. The default value of cpo
is aABceFs
.
When I set ft=python
, then set ft=css
. $VIMRUNTIME/ftplugin/css.vim
finish immediately. And omnifunc=pythoncomplete#Complete
all the time.
Should each ftplugin/name.vim
define b:undo_ftplugin
?
This is /usr/share/vim/vim73/ftplugin.vim
:
" Vim support file to switch on loading plugins for file types " " Maintainer: Bram Moolenaar < Bram@vim.org > " Last change: 2006 Apr 30 if exists("did_load_ftplugin") finish endif let did_load_ftplugin = 1 augroup filetypeplugin au FileType * call s:LoadFTPlugin() func! s:LoadFTPlugin() if exists("b:undo_ftplugin") exe b:undo_ftplugin unlet! b:undo_ftplugin b:did_ftplugin endif let s = expand("<amatch>") if s != "" if &cpo =~
This is /usr/share/vim/vim73/ftplugin/css.vim
:
" Vim filetype plugin file " Language: CSS " Maintainer: Nikolai Weibull < now@bitwi.se > " Latest Revision: 2008-07-09 if exists("b:did_ftplugin") finish endif let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim let b:undo_ftplugin = "setl com< cms< inc< fo< ofu<" setlocal comments=s1: commentstring& setlocal formatoptions-=t formatoptions+=croql setlocal omnifunc=csscomplete#CompleteCSS let &l:include = '^\s*@import\s\+\%(url(\)\=' let &cpo = s:cpo_save unlet s:cpo_save
If I set ft=python
, then set ft=css
. Vim cannot pass this test:
if &cpo =~# "S" && exists("b:did_ftplugin")
b:did_ftplugin
not deleted, so ftplugin/css.vim
exits immediately.
source share