Skip to content

Commit 34d6ce4

Browse files
Mathias Lorentevim-scripts
authored andcommitted
Version 0.2.7: Increase comparibility with c/c++ IDE
1 parent a237921 commit 34d6ce4

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

plugin/DoxygenToolkit.vim

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
" DoxygenToolkit.vim
22
" Brief: Usefull tools for Doxygen (comment, author, license).
3-
" Version: 0.2.6
4-
" Date: 11/18/09
3+
" Version: 0.2.7
4+
" Date: 12/06/09
55
" Author: Mathias Lorente
66
"
77
" TODO: add automatically (option controlled) in/in out flags to function
88
" parameters
99
" TODO: (Python) Check default paramareters defined as list/dictionnary/tuple
1010
"
11+
" Note: Solve almost all compatibility problem with c/c++ IDE
12+
"
13+
" Note: Bug correction and improve compatibility with c/c++ IDE
14+
" - Documentation of function with struct parameters are now allowed.
15+
" - Comments are written in two steps to avoid conflicts with c/c++ IDE.
16+
"
1117
" Note: Bug correction (thanks to Jhon Do)
1218
" - DoxygenToolkit_briefTag_funcName and other xxx_xxName parameters
1319
" should work properly now.
@@ -226,7 +232,7 @@
226232
"endif
227233
let loaded_DoxygenToolkit = 1
228234
"echo 'Loading DoxygenToolkit...'
229-
let s:licenseTag = "Copyright (C) \<enter>"
235+
let s:licenseTag = "Copyright (C) \<enter>\<enter>"
230236
let s:licenseTag = s:licenseTag . "This program is free software; you can redistribute it and/or\<enter>"
231237
let s:licenseTag = s:licenseTag . "modify it under the terms of the GNU General Public License\<enter>"
232238
let s:licenseTag = s:licenseTag . "as published by the Free Software Foundation; either version 2\<enter>"
@@ -337,7 +343,7 @@ if !exists("g:DoxygenToolkit_compactDoc")
337343
endif
338344

339345
" Necessary '\<' and '\>' will be added to each item of the list.
340-
let s:ignoreForReturn = ['template', 'explicit', 'inline', 'static', 'virtual', 'void\([[:blank:]]*\*\)\@!', 'const', 'volatile']
346+
let s:ignoreForReturn = ['template', 'explicit', 'inline', 'static', 'virtual', 'void\([[:blank:]]*\*\)\@!', 'const', 'volatile', 'struct']
341347
if !exists("g:DoxygenToolkit_ignoreForReturn")
342348
let g:DoxygenToolkit_ignoreForReturn = s:ignoreForReturn[:]
343349
else
@@ -396,7 +402,8 @@ function! <SID>DoxygenLicenseFunc()
396402
endif
397403
mark d
398404
let l:date = strftime("%Y")
399-
exec "normal O".s:startCommentBlock.substitute( g:DoxygenToolkit_licenseTag, "\<enter>", "\<enter>".s:interCommentBlock, "g" )
405+
exec "normal O".strpart( s:startCommentBlock, 0, 1 )
406+
exec "normal A".strpart( s:startCommentBlock, 1 ).substitute( g:DoxygenToolkit_licenseTag, "\<enter>", "\<enter>".s:interCommentBlock, "g" )
400407
if( s:endCommentBlock != "" )
401408
exec "normal o".s:endCommentBlock
402409
endif
@@ -486,7 +493,8 @@ function! <SID>DoxygenBlockFunc()
486493
exec "normal ".l:insertionMode.s:interCommentTag.g:DoxygenToolkit_blockTag
487494
mark d
488495
exec "normal o".s:interCommentTag."@{ ".s:endCommentTag
489-
exec "normal o".s:startCommentTag." @} ".s:endCommentTag
496+
exec "normal o".strpart( s:startCommentTag, 0, 1 )
497+
exec "normal A".strpart( s:startCommentTag, 1 )." @} ".s:endCommentTag
490498
exec "normal `d"
491499

492500
call s:RestoreParameters()
@@ -511,7 +519,7 @@ function! <SID>DoxygenCommentFunc()
511519
let l:templateParameterPattern = "<[^<>]*>"
512520

513521
let l:classPattern = '\<class\>[[:blank:]]\+\zs'.l:someNameWithNamespacePattern.'\ze.*\%('.l:endDocPattern.'\)'
514-
let l:structPattern = '\<struct\>[[:blank:]]\+\zs'.l:someNameWithNamespacePattern.'\ze.*\%('.l:endDocPattern.'\)'
522+
let l:structPattern = '\<struct\>[[:blank:]]\+\zs'.l:someNameWithNamespacePattern.'\ze[^(),]*\%('.l:endDocPattern.'\)'
515523
let l:enumPattern = '\<enum\>\%(\%([[:blank:]]\+\zs'.l:someNamePattern.'\ze[[:blank:]]*\)\|\%(\zs\ze[[:blank:]]*\)\)\%('.l:endDocPattern.'\)'
516524
let l:namespacePattern = '\<namespace\>[[:blank:]]\+\zs'.l:someNamePattern.'\ze[[:blank:]]*\%('.l:endDocPattern.'\)'
517525

@@ -657,14 +665,17 @@ function! <SID>DoxygenCommentFunc()
657665
" Header
658666
exec "normal `d"
659667
if( g:DoxygenToolkit_blockHeader != "" )
660-
exec "normal O".s:startCommentBlock.g:DoxygenToolkit_blockHeader.s:endCommentBlock
668+
exec "normal O".strpart( s:startCommentBlock, 0, 1 )
669+
exec "normal A".strpart( s:startCommentBlock, 1 ).g:DoxygenToolkit_blockHeader.s:endCommentBlock
661670
exec "normal `d"
662671
endif
663672

664673
" Brief
665674
if( g:DoxygenToolkit_compactOneLineDoc =~ "yes" && l:doc.returns != "yes" && len( l:doc.params ) == 0 )
666675
let s:compactOneLineDoc = "yes"
667-
exec "normal O".s:startCommentTag.g:DoxygenToolkit_briefTag_pre.g:DoxygenToolkit_briefTag_post
676+
"exec "normal O".s:startCommentTag.g:DoxygenToolkit_briefTag_pre.g:DoxygenToolkit_briefTag_post
677+
exec "normal O".strpart( s:startCommentTag, 0, 1 )
678+
exec "normal A".strpart( s:startCommentTag, 1 ).g:DoxygenToolkit_briefTag_pre.g:DoxygenToolkit_briefTag_post
668679
else
669680
let s:compactOneLineDoc = "no"
670681
let l:insertionMode = s:StartDocumentationBlock()
@@ -711,7 +722,8 @@ function! <SID>DoxygenCommentFunc()
711722

712723
" Footer
713724
if ( g:DoxygenToolkit_blockFooter != "" )
714-
exec "normal o".s:startCommentBlock.g:DoxygenToolkit_blockFooter.s:endCommentBlock
725+
exec "normal o".strpart( s:startCommentBlock, 0, 1 )
726+
exec "normal A".strpart( s:startCommentBlock, 1 ).g:DoxygenToolkit_blockFooter.s:endCommentBlock
715727
endif
716728
exec "normal `d"
717729

@@ -746,7 +758,9 @@ endfunction
746758
function! s:StartDocumentationBlock()
747759
" For C++ documentation format we do not need first empty line
748760
if( s:startCommentTag != s:interCommentTag )
749-
exec "normal O".s:startCommentTag
761+
"exec "normal O".s:startCommentTag
762+
exec "normal O".strpart( s:startCommentTag, 0, 1 )
763+
exec "normal A".strpart( s:startCommentTag, 1 )
750764
let l:insertionMode = "o"
751765
else
752766
let l:insertionMode = "O"
@@ -955,7 +969,7 @@ function! s:InitializeParameters()
955969
let &cinoptions = g:DoxygenToolkit_cinoptions
956970
" Compatibility with c/c++ IDE plugin
957971
let s:timeoutlenBackup = &timeoutlen
958-
let &timeout = 0
972+
let &timeoutlen = 0
959973
endfunction
960974

961975

0 commit comments

Comments
 (0)