We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 `
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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), ''],
\ }
endfunction
`
The text was updated successfully, but these errors were encountered: