Example #1
0
    def __init__(self, parent, token):

        # Find our containing snippet for snippet local data
        snippet = parent
        while snippet:
            try:
                self._locals = snippet.locals
                text = snippet.visual_content.text
                mode = snippet.visual_content.mode
                context = snippet.context
                break
            except AttributeError:
                snippet = snippet._parent  # pylint:disable=protected-access
        self._snip = SnippetUtil(token.indent, mode, text, context, snippet)

        self._codes = (
            "import re, os, vim, string, random\n" +
            "\n".join(snippet.globals.get("!p", [])).replace("\r\n", "\n"),
            token.code.replace("\\`", "`"),
        )
        self._compiled_codes = (
            snippet._compiled_globals
            or cached_compile(self._codes[0], "<exec-globals>", "exec"),
            cached_compile(token.code.replace("\\`", "`"),
                           "<exec-interpolation-code>", "exec"),
        )

        NoneditableTextObject.__init__(self, parent, token)
Example #2
0
 def __init__(self, parent):
     NoneditableTextObject.__init__(
         self,
         parent,
         vim_helper.buf.cursor,
         vim_helper.buf.cursor,
         tiebreaker=Position(-1, -1),
     )
Example #3
0
    def __init__(self, parent, token):
        # Find our containing snippet for visual_content
        snippet = parent
        while snippet:
            try:
                self._text = snippet.visual_content.text
                self._mode = snippet.visual_content.mode
                break
            except AttributeError:
                snippet = snippet._parent  # pylint:disable=protected-access
        if not self._text:
            self._text = token.alternative_text
            self._mode = "v"

        NoneditableTextObject.__init__(self, parent, token)
        TextObjectTransformation.__init__(self, token)
Example #4
0
 def __init__(self, parent, tabstop, token):
     NoneditableTextObject.__init__(self, parent, token)
     self._ts = tabstop
Example #5
0
 def __init__(self, parent, token):
     NoneditableTextObject.__init__(self, parent, token)
     self._code = token.code.replace("\\`", "`")
     self._tmpdir = _get_tmp()
Example #6
0
    def __init__(self, parent, token):
        self._code = token.code.replace("\\`", "`").strip()
        self._replaced = False

        NoneditableTextObject.__init__(self, parent, token)