It looks like it should be possible: I'm not sure whether I have the latest version of the omnicppcomplete script, but in my autoload/omni/cpp/complete.vim
, there is a function called s:ExtendTagItemToPopupItem
. In this function, there is:
" Formating information for the preview window
if index(['f', 'p'], tagItem.kind[0])>=0
let szItemWord .= '('
if g:OmniCpp_ShowPrototypeInAbbr && has_key(tagItem, 'signature')
let szAbbr .= tagItem.signature
else
let szAbbr .= '('
endif
endif
After the line (#165 in my version) let szItemWord .= '('
, add:
if (has_key(tagItem, 'signature') == 0) || (tagItem['signature'] =~ '()')
let szItemWord .= ')'
endif
That should do the trick (although I don't use C++ much, so I haven't tested it extensively). It basically checks whether the "signature" of the function contains "()
" as opposed to (for example) "(int *major, int *minor)
". If the brackets are empty, it adds a closing brace.
It could probably be improved by changing '()'
to '(\s*\(void\)\?\s*)'
for completeness: this would check for "()
", "( )
", "(void)
", "( void )
" etc.