Expand any number of arguments with yasnippet

I will show you how to create any number of fields with yasnippet. The source code can be found on github. (Please refer to the link above for how to use yasnippet in the first place)

Expansion of arbitrary arguments

yasnippet can write emacs lisp directly in snippet by writing # type: command in header, which enables automatic generation of snippet. A docstring based on the coding conventions adopted by numpy (based on PEP8, PEP257) in this way. I made a snippet about the argument part.

First of all, please have a demo video. !! snippet_parse.gif

You should be able to make more complicated and convenient snippets by working hard on emacs lisp. We look forward to your hot snippets.


I will also introduce another continuous expansion that combines the above snippet and snippet that creates a function with a docstring.

Continuous development of snippet by hitting tab repeatedly

Also, to achieve this, use .emacs

.emacs


(setq yas-triggers-in-field t)

It is necessary to write.

As before, please watch the demo video first. snippet_successive.gif

that's all.

Recommended Posts

Expand any number of arguments with yasnippet
Count the number of characters with echo
Convert data with shape (number of data, 1) to (number of data,) with numpy.
Reversible scramble for integers of any number of digits
Calculate the total number of combinations with python
Accelerate a large number of simple queries with MySQL
Predict the number of people infected with COVID-19 with Prophet
Manage the package version number of requirements.txt with pip-tools
Summary of Python arguments
Dictionary of keyword arguments
[Homology] Count the number of holes in data with Python
Let's visualize the number of people infected with coronavirus with matplotlib
[Python] Easy reading of serial number image files with OpenCV