diff options
author | Karel Kočí <cynerd@email.cz> | 2016-06-30 16:11:56 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2016-06-30 16:11:56 +0200 |
commit | 9931e0888b2419326ae10ebbfae532261c5c125f (patch) | |
tree | 7504be5daccbb7b7d1ea396754de47b11ed790e5 /vim/bundle/vim-snippets/pythonx | |
parent | e573b3020c032400eed60b649a2cbf55266e6bb0 (diff) | |
download | myconfigs-9931e0888b2419326ae10ebbfae532261c5c125f.tar.gz myconfigs-9931e0888b2419326ae10ebbfae532261c5c125f.tar.bz2 myconfigs-9931e0888b2419326ae10ebbfae532261c5c125f.zip |
Fix submodules
Diffstat (limited to 'vim/bundle/vim-snippets/pythonx')
m--------- | vim/bundle/vim-snippets | 0 | ||||
-rw-r--r-- | vim/bundle/vim-snippets/pythonx/vimsnippets.py | 92 |
2 files changed, 0 insertions, 92 deletions
diff --git a/vim/bundle/vim-snippets b/vim/bundle/vim-snippets new file mode 160000 +Subproject 15d7e5ec26ec93adee4051b6359be90a943aa38 diff --git a/vim/bundle/vim-snippets/pythonx/vimsnippets.py b/vim/bundle/vim-snippets/pythonx/vimsnippets.py deleted file mode 100644 index 6a446a2..0000000 --- a/vim/bundle/vim-snippets/pythonx/vimsnippets.py +++ /dev/null @@ -1,92 +0,0 @@ -"""Helper methods used in UltiSnips snippets.""" - -import string, vim - -def complete(tab, opts): - """ - get options that start with tab - - :param tab: query string - :param opts: list that needs to be completed - - :return: a string that start with tab - """ - msg = "({0})" - if tab: - opts = [m[len(tab):] for m in opts if m.startswith(tab)] - if len(opts) == 1: - return opts[0] - - if not len(opts): - msg = "{0}" - return msg.format("|".join(opts)) - -def _parse_comments(s): - """ Parses vim's comments option to extract comment format """ - i = iter(s.split(",")) - - rv = [] - try: - while True: - # get the flags and text of a comment part - flags, text = next(i).split(':', 1) - - if len(flags) == 0: - rv.append((text, text, text, "")) - # parse 3-part comment, but ignore those with O flag - elif 's' in flags and 'O' not in flags: - ctriple = ["TRIPLE"] - indent = "" - - if flags[-1] in string.digits: - indent = " " * int(flags[-1]) - ctriple.append(text) - - flags, text = next(i).split(':', 1) - assert flags[0] == 'm' - ctriple.append(text) - - flags, text = next(i).split(':', 1) - assert flags[0] == 'e' - ctriple.append(text) - ctriple.append(indent) - - rv.append(ctriple) - elif 'b' in flags: - if len(text) == 1: - rv.insert(0, ("SINGLE_CHAR", text, text, text, "")) - except StopIteration: - return rv - -def get_comment_format(): - """ Returns a 4-element tuple (first_line, middle_lines, end_line, indent) - representing the comment format for the current file. - - It first looks at the 'commentstring', if that ends with %s, it uses that. - Otherwise it parses '&comments' and prefers single character comment - markers if there are any. - """ - commentstring = vim.eval("&commentstring") - if commentstring.endswith("%s"): - c = commentstring[:-2] - return (c, c, c, "") - comments = _parse_comments(vim.eval("&comments")) - for c in comments: - if c[0] == "SINGLE_CHAR": - return c[1:] - return comments[0][1:] - - -def make_box(twidth, bwidth=None): - b, m, e, i = (s.strip() for s in get_comment_format()) - bwidth_inner = bwidth - 3 - max(len(b), len(i + e)) if bwidth else twidth + 2 - sline = b + m + bwidth_inner * m[0] + 2 * m[0] - nspaces = (bwidth_inner - twidth) // 2 - mlines = i + m + " " + " " * nspaces - mlinee = " " + " "*(bwidth_inner - twidth - nspaces) + m - eline = i + m + bwidth_inner * m[0] + 2 * m[0] + e - return sline, mlines, mlinee, eline - -def foldmarker(): - "Return a tuple of (open fold marker, close fold marker)" - return vim.eval("&foldmarker").split(",") |