I'm developing a vim plugin for a new (toy) language called statemachine as part of a bigger project.
I'm trying to get a valid compiler/makeprg loaded in for this file type and I have one defined in compiler/statemachine.vim
However, when I try to run :make or set makeprg? I get make and makeprg= respectively. I also cannot see echoms that I have defined inside compiler/statemachine.vim. So it seems that my code in the file compiler/statemachine.vim is not executing.
Specifically I'm attempting to get this registered with Syntastic as a valid syntax checker, and a pre-requisite for that is getting makeprg and errorformat set to valid values.
I am able to use an equalprg that I have set and can see echoms from syntax_checkers/statemachine/statemachine.vim, so I know that my plugin is being run in some capacity.
And the filetype is detected correctly: set filetype? yields filetype=statemachine
Directory layout of the plugin so far:
.
├── README.md
├── autoload
│ └── statemachine.vim
├── compiler
│ └── statemachine.vim
├── complete.sh
├── example.sm
├── formatter.sh
├── ftdetect
│ └── statemachine.vim
├── ftplugin
│ └── statemachine.vim
├── syntax
│ └── statemachine.vim
├── syntax_checkers
│ └── statemachine
│ └── statemachine.vim
├── test.txt
└── validator.sh
Relevant parts of the vim plugin code:
// autoload/statemachine.vim
function! statemachine#Errorformat()
return '%f:%l:\ %m'
endfunction
//ftdetect/statemachine.vim
au BufNewFile,BufRead *.sm set filetype=statemachine
// syntax_checkers/statemachine/statemachine.vim
function! SyntaxCheckers_statemachine_statemachine_GetLocList() dict
let l:makeprg = self.makeprgBuild({'args': ''})
echom 'inside getloclist'
return SyntasticMake({'makeprg': l:makeprg,
\ 'errorformat': statemachine#errorformat() })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({'filetype': 'statemachine',
\'name': 'statemachine'})
The full vim plugin can be found here: https://github.com/scottopell/vim-statemachine
compiler/statemachine.vimto be sourced automatically? On an unrelated side note: you don't need to escape the space inerrorformat.compiler/<filetype>.vim, so I assumed it was automatic similar tosyntax/<filetype>.vimetc.compiler statemachinesomewhere.compiler statemachineto yourftplugin.