开发者

How can I set a VIM filetype programmatically?

开发者 https://www.devze.com 2023-01-28 16:54 出处:网络
Is there a way to set a vim 开发者_StackOverflow社区filetype programmatically, so instead of doing something like this:

Is there a way to set a vim 开发者_StackOverflow社区filetype programmatically, so instead of doing something like this:

au BufNewFile,BufRead *.dump set filetype=sql

I can do something like this

let g:temp_file_type = 'sql'
au BufNewFile,BufRead *.dump set filetype= g:temp_file_type


You can set options with let by prefixing the option name with &. eg:

let &filetype=g:temp_file_type


put au BufNewFile,BufRead *.dump set filetype=sql into your filetype.vim

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号