Add support for composite filetypes. Fix #37.

This commit is contained in:
Chiel92 2015-01-12 14:17:27 +01:00
parent 8ea12e45d6
commit b25b08fd5f
2 changed files with 4 additions and 0 deletions

View File

@ -135,6 +135,8 @@ For the default formatprogram definitions, the options `expandtab`, `shiftwidth`
This means that the formatting style will match your current vim settings as much as possible.
For the exact default definitions, have a look in `vim-autoformat/plugin/defaults.vim`.
If you have a composite filetype with dots (like `django.python` or `php.wordpress`), vim-autoformat internally replaces the dots with underscores so you can define formatters through `g:formatprg_django_python` and so on.
Things that are not (yet) implemented
----------------------------------------------------------

View File

@ -1,6 +1,8 @@
"Function for finding and setting the formatter with the given name
function! s:set_formatprg(...)
let type = a:0 ? a:1 : &filetype
"Support composite filetypes by replacing dots with underscores
let type = substitute(type, "[.]", "_", "g")
"Get formatprg config
let s:formatprg_var = "g:formatprg_".type