代码: 全选
fun s:Load(sid, ref)
if a:ref>1
return
endif
augroup filetypelib
au FileType * call s:ReSet()
au BufUnload * call s:UnSet()
augroup END
endfun
fun s:Free(sid, ref)
if a:ref>1
return
endif
augroup filetypelib
au! FileType *
au! BufUnload *
augroup END
endfun
fun s:ReSet()
call s:UnSet()
let buf=expand("<afile>:p")
let ft=expand("<amatch>")
call setbufvar(buf, "filetype_bak", ft)
call Lib_LoadAll("filetype/".ft.".vim", buf)
endfun
fun s:UnSet()
let buf=expand("<afile>:p")
let ft=getbufvar(buf, "filetype_bak")
if ft!=""
call Lib_FreeAll("filetype/".ft.".vim", buf)
call setbufvar(buf, "filetype_bak", "")
endif
endfun
代码: 全选
:h E94
:bdelete[!] {bufname} *E93* *E94*
类似 ":bdelete[!] [N]",但是使用名字指定缓冲区。
注意 如果缓冲区名字是一个数字,不能使用名字来访问;而应用其编
号代替。如果名字里含有空格,在空格前插入反斜杠。