tl;dr
Developed the ability to deploy dynamic pydocstring using ultisnips in vim/neovim
There are countless ways to automatically insert a Docstring in Python, but personally
Acts like a snippet triggered by " ""
(triple quotes) and
I wanted something that would allow me to jump to placeholders that needed to be described.
def sugoi_kansuu(hoge: int, fuga: str) -> None:
"""The cursor is here
When unfolded
def sugoi_kansuu(hoge: int, fuga: str) -> None:
"""
{Where to write the function description}
Args:
hoge (int): {Where to write the argument description}
fuga (str): {Where to write the argument description}
"""
In this way, it is like the cursor jumps one after another to the place where you write the explanation with a tab or some key.
A little convenient
To use it, just prepare the following ultisnips settings
global !p
from nayvy_vim_if.ultisnips import (
generate_pydocstring,
)
endglobal
post_jump "generate_pydocstring(snip)"
snippet """ "Pydocstring" w
endsnippet
(https://github.com/relastle/vim-nayvy)
Recommended Posts