1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 09:35:01 +08:00

Updated plugins

This commit is contained in:
Amir Salihefendic
2019-05-17 16:09:13 +02:00
parent 5a2572df03
commit fae0b73f0d
154 changed files with 3522 additions and 1370 deletions

View File

@ -16,21 +16,21 @@ namespace ${1:MyNamespace}
endsnippet
snippet class "class" w
${1:public} class ${2:MyClass}
${1:public} class ${2:`!p snip.rv = snip.basename`}
{
$0
}
endsnippet
snippet struct "struct" w
struct ${1:MyStruct}
struct ${1:`!p snip.rv = snip.basename`}
{
$0
}
endsnippet
snippet interface "interface" w
interface I${1:Interface}
interface I${1:`!p snip.rv = snip.basename`}
{
$0
}

View File

@ -51,7 +51,9 @@ DOUBLE_QUOTES = '"'
class Arg(object):
def __init__(self, arg):
self.arg = arg
self.name = arg.split('=')[0].strip()
name_and_type = arg.split('=')[0].split(':')
self.name = name_and_type[0].strip()
self.type = name_and_type[1].strip() if len(name_and_type) == 2 else None
def __str__(self):
return self.name
@ -62,6 +64,9 @@ class Arg(object):
def is_kwarg(self):
return '=' in self.arg
def is_vararg(self):
return '*' in self.name
def get_args(arglist):
args = [Arg(arg) for arg in arglist.split(',') if arg]
@ -211,7 +216,7 @@ def write_init_body(args, parents, snip):
if parents:
snip.rv += '\n' + snip.mkline('', indent='')
for arg in args:
for arg in filter(lambda arg: not arg.is_vararg(), args):
snip += "self._%s = %s" % (arg, arg)