-
Notifications
You must be signed in to change notification settings - Fork 148
Description
When generate modeline using user-variable. The func to generate custom modeline should know which filetype to generate.
So howto pass the filetype to the func. My code as flowwing
`
let g:templates_user_variables = [
\ ['MODELINE', 'Modeline_str'],
\ ]
function! Modeline_str(type)
let modeline = {
\ 'c' : [printf('/* vi: set ft=c fo=%s tw=100 sw=8 ts=8 sts=8 fenc=utf-8 ai noet: /', s:my_formatoptions), ''],
\ 'cpp' : [printf('/ vi: set ft=cpp fo=%s tw=100 sw=8 ts=8 sts=8 fenc=utf-8 ai noet: */', s:my_formatoptions), ''],
\ 'sh' : ['#!/bin/bash',
\ printf('# vi: set ft=sh fo=%s tw=100 sw=4 ts=4 sts=4 fenc=utf-8 isk-=. ai et:', s:my_formatoptions),
\ ''],
\ 'make' : [printf('# vi: set ft=make fo=%s tw=100 sw=8 ts=8 sts=8 fenc=utf-8 ai noet:', s:my_formatoptions), ''],
\ }
if !has_key(modeline, a:type)
return ''
endif
return modeline[a:type]
endfunction
`