I'm trying to achieve something simple, usually called "function hints". For example, scintilla-based editors have it:
You type a name, and just get the prototype. There are a few problems with that in vim:
(
, you'll just get "Pattern not found"I've tried a few plugins; most of them mess things up even more [^1].Can anyone recommend a simple way to get just that ? A simple rectangle containing the function prototype and nothing more.
[^1] It's really mind-numbing how idiotic some of these plugins are. One plugin (I won't mention it) actually contained in the .vim file a list of functions from libc.
ctags
for autocompletion is a mess. I suggest you try a compiler based plugin such as clang-complete or gcc-sense (haven't tried this one). Advantages are:
You have to rebuild the ctags to keep it up to date
you don't need to deal with ctags (they are still useful to jump around though)
You can't type C-X C-O after the (, you'll just get "Pattern not found"
what would you expect?
You can't type C-X C-O in normal mode, the cursor will just jump around
you can always remap that sequence if you think it's a frequent mistake (something like nnoremap <C-x><C-o> a<C-x><C-o>
)
You get the annoying preview window at the top
You can disable this by removing preview
fromcompleteopt
option. see :help completeopt
I'm using the following setup:
tab
keyand some vimrc settings:
set pumheight=10 " so the complete menu doesn't get too big
set completeopt=menu,longest " menu, menuone, longest and preview
let g:SuperTabDefaultCompletionType='context'
let g:clang_complete_auto=0 " I can start the autocompletion myself, thanks..
let g:clang_snippets=1 " use a snippet engine for placeholders
let g:clang_snippets_engine='ultisnips'
let g:clang_auto_select=2 " automatically select and insert the first match
Enjoy!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With