コード例 #1
0
ファイル: vhdl.snippets.py プロジェクト: drmikehenry/vimfiles
#!/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
コード例 #2
0
ファイル: make.snippets.py プロジェクト: drmikehenry/vimfiles
#!/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=[],
コード例 #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"])
コード例 #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
""")
コード例 #5
0
ファイル: rst.snippets.py プロジェクト: drmikehenry/vimfiles
#!/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"
コード例 #6
0
#!/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.} */")
コード例 #7
0
ファイル: d.snippets.py プロジェクト: dbernard/vimfiles
#!/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")

コード例 #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
""")
コード例 #9
0
ファイル: vhdl.snippets.py プロジェクト: drmikehenry/vimfiles
#!/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
コード例 #10
0
ファイル: c.snippets.py プロジェクト: dtshepherd/vimfiles
# 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
{
コード例 #11
0
ファイル: c.snippets.py プロジェクト: dbernard/vimfiles
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
}
コード例 #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"""
コード例 #13
0
ファイル: c.snippets.py プロジェクト: hhymarco/vimfiles
# 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
{
コード例 #14
0
ファイル: c.snippets.py プロジェクト: drmikehenry/vimfiles
# 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
{
コード例 #15
0
ファイル: java.snippets.py プロジェクト: hhymarco/vimfiles
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

""")
コード例 #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 <*****@*****.**>
""")
コード例 #17
0
ファイル: make.snippets.py プロジェクト: hhymarco/vimfiles
#!/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=[])
コード例 #18
0
ファイル: rst.snippets.py プロジェクト: randyransier/vimfiles
#!/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."""
コード例 #19
0
ファイル: c.snippets.py プロジェクト: dbernard/vimfiles
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
}