I have a plugin function called InComment() stored in magic.vim *1
I would like to share it between two ftplugin files:
- ftplugin/c.vim
- ftplugin/python.vim
What is the idiomatic way to call InComment() function from my ftplugin files?
*1 plugin/magic.vim
function! s:InComment() " {{{
let syn = s:SyntaxName(line('.'), col('.') - 1, 1)
if syn =~? 'comment'
return 1
else
return 0
endif
endfunction "}}}
The document referenced by Prince Goulash has everything you need. To answer you specifically, you need to give the function a name based on the name of your plugin, like this:
Then you can call it from your plugin like this:
The part before the # has to match the name of your plugin file. This will also cause the plugin to be autoloaded when the function is called.