When I write Doxygen comments (in C file) I would like an asterisk to be automatically inserted on new line (either with the o
command or just ↩ ).
Like this example :
/**
* My Doxygen comment being written
And when I hit ↩
/**
* My Doxygen comment bein written
*
^
cursor is here
I have DoxygenToolkit.vim and set syntax=c.doxygen
but none does what I want.
I also found that but not sure what it is supposed to do, but doesn't solve my problem.
I've googled for it but did not find.
Any idea?
You need this in your ~/.vimrc
:
filetype plugin indent on
I don't know about DoxygenToolkit.vim, I have never used it. The above is all it takes to enable the described behaviour in my 7.x Vims.
You can find my commented ~/.vimrc online. Nothing too fancy in there, just what I use every day on half a dozen different Linux / AIX boxes. Perhaps there is more in there that you would like.
:setlocal formatoptions+=ro
does that (:help fo-table
).
o Automatically insert the current comment leader after hitting 'o' or 'O' in Normal mode. r Automatically insert the current comment leader after hitting <Enter> in Insert mode.
Put this into ~/.vim/after/ftplugin/c.vim
. (This requires that you have :filetype plugin on
; use of the after directory allows you to override any default filetype settings done by $VIMRUNTIME/ftplugin/c.vim
.) Alternatively, you could define an :autocmd FileType c ...
directly in your ~/.vimrc
, but this tends to become unwieldy once you have many customizations.
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