1
0
mirror of https://github.com/amix/vimrc synced 2025-07-04 23:15:01 +08:00

Update some plugins.

This commit is contained in:
Kurtis Moxley
2022-08-08 16:41:37 +08:00
parent f6ba361e3e
commit bbbedb5311
15 changed files with 204 additions and 79 deletions

View File

@ -343,6 +343,18 @@ write_init_body(args, t[2], snip)
endsnippet
snippet dcl "dataclass" b
@dataclass
class ${1:MyClass}:
`!p snip.rv = triple_quotes(snip)`${2:Docstring for $1. }`!p snip.rv = triple_quotes(snip)`
${3:var_1}: ${4:int}
${5:var_2}: ${6:float} = ${7:0}
def ${8:total}(self): -> $6:
return ${0:self.$3 * self.$5}
endsnippet
snippet contain "methods for emulating a container type" b
def __len__(self):
${1:pass}
@ -603,9 +615,9 @@ $1 = property(**$1(), doc=$1.__doc__)
endsnippet
####################
# If / Else / Elif #
####################
############################
# If / Else / Elif / Match #
############################
snippet if "If" b
if ${1:condition}:
${2:${VISUAL:pass}}
@ -627,6 +639,22 @@ else:
${5:pass}
endsnippet
snippet match "Structural pattern matching" b
match ${1:expression}:
case ${2:pattern_1}:
${3:pass}
case ${4:pattern_2}:
${0:pass}
endsnippet
snippet matchw "Pattern matching with wildcard" b
match ${1:expression}:
case ${2:pattern_1}:
${3:pass}
case _:
${0:pass}
endsnippet
##########################
# Try / Except / Finally #

View File

@ -1,8 +1,8 @@
{
"name" : "snipmate-snippets",
"name" : "vim-snippets",
"author" : "community",
"maintainer" : "honza @ github & others",
"repository" : {"type": "git", "url": "git://github.com/honza/snipmate-snippets.git"},
"repository" : {"type": "git", "url": "git://github.com/honza/vim-snippets.git"},
"dependencies" : {
},
"description" : "community driven set of snippets for snipmate"

View File

@ -12,6 +12,7 @@ snippet uni
${0:representation}
snippet from
from ${1:package} import ${0:module}
# Module Docstring
snippet docs
"""
@ -29,18 +30,22 @@ snippet sk "skip unittests" b
snippet wh
while ${1:condition}:
${0:${VISUAL}}
# dowh - does the same as do...while in other languages
snippet dowh
while True:
${1}
if ${0:condition}:
break
snippet with
with ${1:expr} as ${2:var}:
${0:${VISUAL}}
snippet awith
async with ${1:expr} as ${2:var}:
${0:${VISUAL}}
# New Class
snippet cl
class ${1:ClassName}(${2:object}):
@ -52,11 +57,24 @@ snippet cl
snippet cla
class ${1:class_name}:
"""${0:description}"""
snippet clai
class ${1:class_name}:
"""${2:description}"""
def __init__(self, ${3:args}):
${0}
# Data class
snippet dcl dataclass
@dataclass
class ${1:ClassName}:
"""${2:description}"""
${3:var_1}: ${4:int}
${5:var_2}: ${6:float} = ${7:0}
def ${8:total}(self): -> $6:
return ${0:self.$3 * self.$5}
# New Function
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
@ -72,6 +90,7 @@ snippet adef
snippet adeff
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${0}
# New Method
snippet defi
def __init__(self, ${1:args}):
@ -104,10 +123,28 @@ snippet el
snippet ei
elif ${1:condition}:
${0:${VISUAL}}
# Match
snippet match Structural pattern matching
match ${1:expression}:
case ${2:pattern_1}:
${3:pass}
case ${4:pattern_2}:
${5:pass}
# Match with wildcard
snippet matchw Pattern matching with wildcard
match ${1:expression}:
case ${2:pattern_1}:
${3:pass}
case _:
${0:pass}
# For
snippet for
for ${1:item} in ${2:items}:
${0}
# Encodes
snippet cutf8
# -*- coding: utf-8 -*-
@ -115,15 +152,18 @@ snippet clatin1
# -*- coding: latin-1 -*-
snippet cascii
# -*- coding: ascii -*-
# Lambda
snippet ld
${1:var} = lambda ${2:vars} : ${0:action}
snippet ret
return ${0}
snippet .
self.
snippet sa self.attribute = attribute
self.${1:attribute} = $1
snippet try Try/Except
try:
${1:${VISUAL}}
@ -152,6 +192,7 @@ snippet tryef Try/Except/Else/Finally
${5}
finally:
${0}
# if __name__ == '__main__':
snippet ifmain
if __name__ == '__main__':
@ -196,9 +237,11 @@ snippet nosetrace
__import__('nose').tools.set_trace()
snippet pprint
__import__('pprint').pprint(${1})
snippet "
"""${0:doc}
"""
# assertions
snippet a=
self.assertEqual(${0}, ${1})
@ -219,6 +262,7 @@ snippet tgwt
# then: ${3}
snippet fut
from __future__ import ${0}
#getopt
snippet getopt
try:
@ -236,6 +280,7 @@ snippet getopt
${0}
elif option in ("-v", "--verbose"):
verbose = argument
# argparse
snippet addp
parser = ${VISUAL:argparse.}ArgumentParser()
@ -279,7 +324,7 @@ snippet epydoc
"""
snippet dol
def ${1:__init__}(self, *args, **kwargs):
super(${0:ClassName}, self).$1(*args, **kwargs)
super(${0:ClassName}, self).$1(*args, **kwargs)
snippet kwg
self.${1:var_name} = kwargs.get('$1', ${2:None})
snippet lkwg

View File

@ -63,7 +63,7 @@ snippet eq equation environment
snippet eql Labeled equation environment
\\begin{equation}
\\label{eq:${2}}
${0:${VISUAL}}
${0:${VISUAL}}
\\end{equation}
# Equation
snippet eq* unnumbered equation environment
@ -406,6 +406,10 @@ snippet ddot ddot
snippet vec vector
\\vec{{$1}} {$0}
# Bar
snippet bar bar
\\bar{{$1}} {$0}
# Cross product
snippet \x cross product
\\times {$0}