为Vim'添加一个钩子;默认缓冲区
我想配置Vim,以便当[No Name]缓冲区打开时,语法设置为markdown。这可能吗?在维姆的帮助下,我看不到这样的诱惑 我使用的是Vim 7.3,它是用为Vim'添加一个钩子;默认缓冲区,vim,Vim,我想配置Vim,以便当[No Name]缓冲区打开时,语法设置为markdown。这可能吗?在维姆的帮助下,我看不到这样的诱惑 我使用的是Vim 7.3,它是用--with features=ground编译的,这里提到: “默认文件类型 设g:do_filetype=0 au GUIEnter,BufAdd*if expand(“”)=“”|让g:do_filetype=1 | endif au BufEnter*如果g:do_文件类型| setf markdown |让g:do_文件类型=0
--with features=ground
编译的,这里提到:
“默认文件类型
设g:do_filetype=0
au GUIEnter,BufAdd*if expand(“”)=“”|让g:do_filetype=1 | endif
au BufEnter*如果g:do_文件类型| setf markdown |让g:do_文件类型=0 | endif
我的理解是,为什么需要使用全局变量,而不是立即设置文件类型,因为触发autocmd时缓冲区尚未完全创建
谢谢!这适用于gui。我将GUIEnter改为BufWenter,使其在终端中工作。
" default filetype
let g:do_filetype = 0
au GUIEnter,BufAdd * if expand('<afile>') == "" | let g:do_filetype = 1 | endif
au BufEnter * if g:do_filetype | setf markdown | let g:do_filetype = 0 | endif