diff --git a/editors/vim/README.md b/editors/vim/README.md index de5448b..712ad69 100644 --- a/editors/vim/README.md +++ b/editors/vim/README.md @@ -44,3 +44,11 @@ Conflicts This plugin conflicts with the DScanner plugin, as both use the `dcomplete` autoload namespace and the `dcomplete#Complete` function - as per Vim's conventions. + +Configuration +============= + +If you want to never add the closing paren in calltips completions, add this to you vimrc: +```vim +let g:dcd_neverAddClosingParen=1 +``` diff --git a/editors/vim/autoload/dcomplete.vim b/editors/vim/autoload/dcomplete.vim index 608f799..0d337e7 100644 --- a/editors/vim/autoload/dcomplete.vim +++ b/editors/vim/autoload/dcomplete.vim @@ -1,6 +1,10 @@ "The completion function function! dcomplete#Complete(findstart,base) if a:findstart + + "We might need it for paren completion: + let b:closingParenExists=getline('.')[col('.')-1:-1]=~'^\s*)' + let prePos=searchpos('\W',"bn") let preChar=getline(prePos[0])[prePos[1]-1] if '.'==preChar @@ -131,7 +135,10 @@ function! s:parseCalltips(base,resultLines) call add(funcArgs,'') endif endfor - let funcArgsString=join(funcArgs,', ').')' + let funcArgsString=join(funcArgs,', ') + if !b:closingParenExists && !(exists('g:dcd_neverAddClosingParen') && g:dcd_neverAddClosingParen) + let funcArgsString=funcArgsString.')' + endif call add(result,{'word':funcArgsString,'abbr':substitute(resultLine,'\\n\\t','','g'),'dup':1}) end endfor