Among the well-known plug-ins of VIM code snippet completion are vim-snipmate and ultsnips. In my environment, snipmate cannot be used because of conflicts, so ultisnips is used. They all use the same vim-snippets as the configuration file and store it in the corresponding directory. Their formats are basically the same, but there are also some differences. I personally feel that ultisnips provides more extensions.
Ultisnipsedit: Quickly open and edit the configuration file named <current file extension>. snippets
Basic Format:
Snippet <Tigger> "annotation" <flag> $ {1: Name }$ {1/(\ W +). */$ {1}/} endsnippet
You can directly use shell scripts or!v
Embed vimscript or!p
Embed Python
snippet date "date"`echo $(date)`end snippet
Passglobal !p
Directly embed Python scripts
global !pendglobal
Python Variables
FN: file name path: path T: placeholder T [1] snip: Provision Method
Example:
snippet def "def" def ${1:name}: ${2:`!p `}endsnippet
snippet "rep (\d+) (\w+)" "def" rdef ${1:name}: ${2:`!p snip.rv=int(match.group(1))*match.group(2)`}endsnippet
extends c
Reference other configurations
?