Exemplo n.º 1
0
#!/usr/bin/env python3

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

put(r"""
priority -5
""")

# 'if' snippets.
bsnip(
    "if",
    "if ... then ... end if;",
    r"""
if $1 then
    $0
end if;
""",
)

bsnip(
    "ifclk",
    "if clk'event and clk = '1' then ... end if;",
    r"""
if clk'event and clk = '1' then
Exemplo n.º 2
0
#!/usr/bin/env python3

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

put(r"""
priority -5
""")

wsnip(
    "ca",
    "$(call ",
    """
$(call $0
""",
    aliases=["call"],
)

wsnip(
    "cs",
    "$(call S.",
    """
$(call S.$0
""",
    aliases=[],
Exemplo n.º 3
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import os
import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

put(r"""
global !p
from sniputil import betterVisual
endglobal
""")

bsnip("chap", "Chapter/Title", r"""
# $0
""")

bsnip("sect", "Section", r"""
## $0
""", aliases=["h1"])

bsnip("subsec", "Subsection", r"""
### $0
""", aliases=["h2"])
Exemplo n.º 4
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr


put(r"""
priority -5

extends c
""")
Exemplo n.º 5
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr
from sniputil import put

put(r"""
priority -5

global !p
from sniputil import betterVisual
endglobal
""")

# Title snippets.

def tsnip(trigger, desc, char, withOverline=False, flags="b", aliases=[],
        trimBody=True):
    """Title snippet."""

    line = "`!p snip.rv = len(t[1]) * %r`\n" % char

    body = ""
    if withOverline:
        body = body + line
    body = body + "${1:" + desc + "}\n" + line + "\n$0\n"
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

put(r"""
global !p
from sniputil import betterVisual
endglobal
""")

bsnip("docstring", "docstring for func or type", r"""
/**
 *  ${1:Brief description.}
 *
 *  ${0:Full description.}
 */
""", flags="b", aliases=["doc", "/**"])

# Javadoc.
wabbr("@param",     "@param ${1:inParam}  ${0:@todo Description of $1.}",
        aliases=["@p", "@pi", "@po", "@pio"])
wabbr("@return",    "@return ", aliases=["@re", "@ret", "@retval", "@rv"])
wabbr("todo",  "/** @todo ${1:Description of what's TO DO.} */")
wabbr("bug",   "/** @bug ${1:Description of BUG.} */")
Exemplo n.º 7
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import sys
import re

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr


# Snippets are now cleared in "clearsnippets" directory.
put("extends c\n")

Exemplo n.º 8
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr
from sniputil import put

put(r"""
priority -5

global !p
from sniputil import autoPeriod
endglobal
""")

bsnip("#!", "#!/usr/bin/env python...", r"""
#!/usr/bin/env python
# vim:set fileencoding=utf8: #

""")

# 'if' snippets.

bsnip("if", "if ...:<CR>", r"""
if $1:
    $0
""")
Exemplo n.º 9
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

put(r"""
priority -5
""")

# 'if' snippets.
bsnip("if", "if ... then ... end if;", r"""
if $1 then
    $0
end if;
""")

bsnip("ifclk", "if clk'event and clk = '1' then ... end if;", r"""
if clk'event and clk = '1' then
    $0
end if;
""")

bsnip("else", "else ...", r"""
else
Exemplo n.º 10
0
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr


put(r"""
priority -5

global !p
from sniputil import betterVisual
from sniputil import autoPeriod
endglobal
""")

# 'if' snippets.
bsnip("if", "if (...) {...}", r"""
if ($1)
{
    `!p betterVisual(snip)`$0
}
""")

bsnip("else", "else {...}", r"""
else
{
Exemplo n.º 11
0
from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

# Snippets are now cleared in "clearsnippets" directory.
#put("clearsnippets\n")

put(r"""
global !p
def betterVisual(snip, contIndentLevel=1):
    import textwrap

    text = textwrap.dedent(snip.v.text)
    for i, line in enumerate(text.splitlines()):
        if i == 0:
            snip.rv = snip.mkline(line)
            snip.shift(contIndentLevel)
        elif line.strip():
            snip += line
        else:
            # Avoid indentation for empty lines.
            snip.rv += "\n"
endglobal
""")

# 'if' snippets.
bsnip("if", "if (...) {...}", r"""
if ($1)
{
    `!p betterVisual(snip)`$0
}
Exemplo n.º 12
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

put(r"""
priority -5

global !p
from sniputil import betterVisual
from sniputil import autoPeriod
endglobal
""")

# 'if' snippets.
bsnip("if", "if (...) {...}", r"""
if ($1)
{
    `!p betterVisual(snip)`$0
}
""")

bsnip("else",
      "else {...}",
      r"""
Exemplo n.º 13
0
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr


put(r"""
priority -5

global !p
from sniputil import betterVisual
endglobal
""")

# 'if' snippets.
bsnip("if", "if (...) {...}", r"""
if ($1)
{
    `!p betterVisual(snip)`$0
}
""")

bsnip("else", "else {...}", r"""
else
{
Exemplo n.º 14
0
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr


put(r"""
priority -5

global !p
from sniputil import betterVisual
from sniputil import autoPeriod
endglobal
""")

# 'if' snippets.
bsnip("if", "if (...) {...}", r"""
if ($1)
{
    `!p betterVisual(snip)`$0
}
""")

bsnip("else", "else {...}", r"""
else
{
Exemplo n.º 15
0
from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

bsnip("docstring", "docstring for func or type", r"""
/**
 *  ${1:Brief description.}
 *
 *  ${0:Full description.}
 */
""", flags="b!", aliases=["doc", "/**"])

# Javadoc.
wabbr("@param",     "@param ${1:inParam}  ${0:@todo Description of $1.}",
        aliases=["@p", "@pi", "@po", "@pio"])
wabbr("@return",    "@return ", aliases=["@re", "@ret", "@retval", "@rv"])
wabbr("todo",  "/** @todo ${1:Description of what's TO DO.} */")
wabbr("bug",   "/** @bug ${1:Description of BUG.} */")

put(r"""
snippet printf "printf('...', ...);" w!
System.out.printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/}
endsnippet

snippet pf "printf('...', ...);" w!
System.out.printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/}
endsnippet

""")
Exemplo n.º 16
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import os
import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

put("extends markdown\n")

bsnip("ab", "Acked-by: ...", r"""
Acked-by: John Szakmeister <*****@*****.**>
""")

bsnip("sob", "Signed-off-by: ...", r"""
Signed-off-by: John Szakmeister <*****@*****.**>
""")

bsnip("rb", "Reviewed-by: ...", r"""
Reviewed-by: John Szakmeister <*****@*****.**>
""")
Exemplo n.º 17
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import put

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr

put(r"""
priority -5
""")

wsnip("call", "$(call )","""
$(call $0)
""", aliases=["c"])

wsnip("v", "$()","""
$($0)
""", aliases=[])

bsnip("def", "define funcName...endef $(call S.def,funcName)","""
define $1
  $0
endef
$(call S.def,$1)
""", aliases=[])
Exemplo n.º 18
0
#!/usr/bin/env python
# vim:set fileencoding=utf8:

import sys
import re
import setpypath

from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr
from sniputil import put

put(r"""
priority -5

global !p
from sniputil import betterVisual
endglobal
""")

# Title snippets.


def tsnip(trigger,
          desc,
          char,
          withOverline=False,
          flags="b",
          aliases=[],
          trimBody=True):
    """Title snippet."""
Exemplo n.º 19
0
from sniputil import snip, bsnip, wsnip
from sniputil import abbr, babbr, wabbr


# Snippets are now cleared in "clearsnippets" directory.
#put("clearsnippets\n")

put(r"""
global !p
def betterVisual(snip, contIndentLevel=1):
    import textwrap

    text = textwrap.dedent(snip.v.text)
    for i, line in enumerate(text.splitlines()):
        if i == 0:
            snip.rv = snip.mkline(line)
            snip.shift(contIndentLevel)
        elif line.strip():
            snip += line
        else:
            # Avoid indentation for empty lines.
            snip.rv += "\n"
endglobal
""")

# 'if' snippets.
bsnip("if", "if (...) {...}", r"""
if ($1)
{
    `!p betterVisual(snip)`$0
}