Closed sTiKyt closed 3 years ago
@sTiKyt Hi, thank you for question!
Is it possible for doc strings to be added automatically like it's done in PyCharm?
No. And I don't have any plan to implement this.
I think """
trigger has side-effect.
So, I don't want to maintain trigger pattern.
But, You can create your own trigger pattern to your vimrc(at your own risk 😉 )
https://user-images.githubusercontent.com/56591/108491581-6f954f00-72e7-11eb-9709-2851fb7e0b3f.mp4
Note this is just sample.
let s:pydocstrings = []
function! s:pydocstring_run(timer) abort
execute 'normal! dd'
execute 'normal! k'
call pydocstring#insert()
endfunction
function! s:pydocstring_trigger()
call add(s:pydocstrings, v:char)
if join(s:pydocstrings_, '') ==# '"""'
execute 'stopinsert'
call timer_start(0, function('s:pydocstring_run'))
endif
endfunction
autocmd InsertCharPre * call s:pydocstring_trigger()
autocmd InsertLeave * let s:pydocstrings = []
Thanks you a lot, I'll setup my own script in vimrc then 👌
Is it possible for doc strings to be added automatically like it's done in PyCharm?
Would be cool if it could generate doc-strings if i press enter after
"""
Instead of need to type command Reference: https://www.jetbrains.com/help/pycharm/creating-documentation-comments.html