Add Python snippets for YASnippets
This commit is contained in:
parent
eb6cda3025
commit
85d644c68a
12
etc/yasnippet/snippets/python-mode/base_class
Normal file
12
etc/yasnippet/snippets/python-mode/base_class
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Uses .yas-setup.el.
|
||||
# name : base class
|
||||
# key : bcls
|
||||
# expand-env: ((yas-indent-line 'fixed))
|
||||
# --
|
||||
class ${1:ClassName}:
|
||||
"""${2:XXX}.${3:$(python-arguments-to-doc-string)}"""
|
||||
|
||||
def __init__(self, $3):
|
||||
${3:$(python-arguments-to-self-init-string)}$0pass
|
||||
|
8
etc/yasnippet/snippets/python-mode/def_function
Normal file
8
etc/yasnippet/snippets/python-mode/def_function
Normal file
@ -0,0 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Uses .yas-setup.el.
|
||||
# name : def function
|
||||
# key : deff
|
||||
# --
|
||||
def ${1:name}($2):
|
||||
"""${3:XXX.}${2:$(python-arguments-to-doc-string)}"""
|
||||
$0pass
|
9
etc/yasnippet/snippets/python-mode/def_method
Normal file
9
etc/yasnippet/snippets/python-mode/def_method
Normal file
@ -0,0 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Uses .yas-setup.el.
|
||||
# name : def method
|
||||
# key : defm
|
||||
# --
|
||||
def ${1:name}(self$2):
|
||||
"""${3:XXX.}${2:$(python-arguments-to-doc-string)}"""
|
||||
$0pass
|
||||
|
12
etc/yasnippet/snippets/python-mode/derived_class
Normal file
12
etc/yasnippet/snippets/python-mode/derived_class
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Uses .yas-setup.el.
|
||||
# name : derived class
|
||||
# key : dcls
|
||||
# expand-env: ((yas-indent-line 'fixed))
|
||||
# --
|
||||
class ${1:ClassName}(${2:object}):
|
||||
"""${3:XXX}.${4:$(python-arguments-to-doc-string)}"""
|
||||
|
||||
def __init__(self, $4):
|
||||
${4:$(python-arguments-to-self-init-string)}$0pass
|
||||
|
23
etc/yasnippet/snippets/python-mode/program
Normal file
23
etc/yasnippet/snippets/python-mode/program
Normal file
@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# name : program
|
||||
# key : program
|
||||
# expand-env : ((yas-indent-line 'fixed))
|
||||
# --
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""${1:XXX}."""
|
||||
|
||||
import numpy
|
||||
|
||||
|
||||
def main():
|
||||
"""${2:XXX}."""
|
||||
$0pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
# Local Variables:
|
||||
# mode: python
|
||||
# End:
|
2
etc/yasnippet/snippets/python-ts-mode/.yas-parents
Normal file
2
etc/yasnippet/snippets/python-ts-mode/.yas-parents
Normal file
@ -0,0 +1,2 @@
|
||||
python-mode
|
||||
|
Loading…
Reference in New Issue
Block a user