I use vim to develop with Python and it works fine. However I want to improve the behavior for documenting my code. For instance I wrote this in vimrc :
:iabbrev """ """ """<Esc>3hi
It works fine but I would like to differentiate the behavior depending on which key is used after """, either <Space> or <CR>. The result should be like that :
""" blablashould give""" blabla """"""<CR>blablashould give :""" blabla """
For the first form, the command :iabbrev """<Space> """ """<Esc>3hi give E474: Invalid argument. As written in help I escaped <Space> with CTRL+V but even if there is no error there is no behavior.
For the second one, the command :iabbrev """<CR> """<ESC>yyPA is accepted but nothing happens when I enter """<CR> else the normal behavior.