Example #1
0
    def __init__(self, title='', position = '',
            vertical=False, width=25, height=15, ft='fraintmp'):
        self.b = None
        self.w = None

        self.title = title
        self.Buf_Close_Hook = None
        self.Buf_New_Hook = None

        self.ft = ft

        self.width = width
        self.height = height
        self.position = position

        self.vertical = vertical

        if self.vertical:
            self.size = self.width
            self.cmd = "vnew"
        else:
            self.size = self.height
            self.cmd = "new"
        self.previous = None

        pyvim.addevent("WinLeave", self._previous)
Example #2
0
def TexList():
    global  TEXLIST
    if TEXLIST:
        return

    TEXLIST = frainui.LIST("TexList", List1)
    TEXLIST.FREventBind("ListReFreshPre", ReFreshPre)
    TEXLIST.show()
    TEXLIST.refresh()

    pyvim.addevent("BufEnter", find)
Example #3
0
    def __init__(self):
        self.buf_node = None
        self.new_files = {}

        self.origin_window_title = pyvim.gettitle()

        listwin = LIST("frain", helper_listwin.FrainListGetRootsHook)

        listwin.FREventBind("List-ReFresh-Post",
                helper_listwin.FrainListRefreshHook)

        listwin.FREventBind("List-ReFresh-Pre",
                helper_listwin.FrainListRefreshPreHook)


        pyvim.addevent("BufEnter",   helper_vim.BufEnter,   arg = (self,))
        pyvim.addevent("BufNewFile", helper_vim.BufNewFile, arg = (self,))
        pyvim.addevent("BufNew",     helper_vim.BufNew,     arg = (self,))
        pyvim.addevent('VimLeave',   helper_vim.VimLeave,   arg = (self,))

        listwin.frain = self

        listwin.show()

        self.listwin = listwin
Example #4
0
    def __init__(self):
        be, af = self.cur_word()

        self.indent = self.get_indent(vim.current.line)

        cursor          = vim.current.window.cursor
        self.sc_linenu  = cursor[0]
        self.sc_col     = cursor[1]  - len(be)
        self.pos        = self.get_pos(cursor[0], be + af)
        pyvim.log.error(self.pos)
        self.length     = len(be) + len(af)

        self.evhandle1 = pyvim.addevent('CursorMovedI', self.change)
        self.evhandle2 = pyvim.addevent('InsertLeave',  self.exit)

        SameChange._instance = self
Example #5
0
    def BFCreate(self):
        if self.BFb and self.BFb.valid:
            return

        self.FREventEmit("BF-Create-Pre")

        self.__create_win()
        if self.BFFt:
            vim.command("set ft=%s" % self.BFFt)

        self.FREventEmit("BF-Create-Post")

        self.vimev1 = \
                  pyvim.addevent('QuitPre', self.BFVimEventQuitPre, self.BFb)

        self.vimev2 = \
                  pyvim.addevent('BufWipeout', self.BFVimEventWipeout, self.BFb)

        utils.Objects[self.BFb] = self
Example #6
0
    def __init__(self):
        self.__class__._instance = self

        be, af = self.cur_word()

        self.indent = self.get_indent(vim.current.line)

        cursor          = vim.current.window.cursor
        self.sc_linenu  = cursor[0]
        self.sc_col     = cursor[1]  - len(be)
        self.pos        = self.get_pos(cursor[0], be + af)
        self.length     = len(be) + len(af)

        vim.current.window.cursor = (self.sc_linenu, self.sc_col + self.length
                -1)

        self.evhandle1 = pyvim.addevent('CursorMovedI', self.change,
                vim.current.buffer)
        self.evhandle2 = pyvim.addevent('InsertLeave',  self.exit,
                vim.current.buffer)
Example #7
0
    def show(self):
        """显示当前 buffer 窗口
        如果已经显示, 会 focus 到那个窗口
        """
        buf_back = None
        if self.b and self.b.valid:
            if self.w and self.w.valid:
                vim.current.window = self.w
                return
            else:
                buf_back = "buffer %s" % self.b.number



        cmd = "{pos} {size}{cmd} {file}".format(size = self.size,
                cmd = self.cmd, file=self.title,
                pos = self.position)

        vim.command(cmd)
        self.w = vim.current.window

        if buf_back:
            vim.command(buf_back)
            return
        else:
            if self.ft:
                vim.command("set ft=%s" % self.ft)

            self.FREventEmit("BufNew")

            #if self.Buf_New_Hook:
            #    self.Buf_New_Hook()

            if self.Buf_Close_Hook:
               # pyvim.addevent('BufUnload', self.close_hook, '<buffer>')
                pyvim.addevent('QuitPre', self.Buf_Close_Hook, self.b)

            self.b = vim.current.buffer
            utils.Objects[self.b] = self
Example #8
0
    def __init__(self):
        if hasattr(self, 'listwin'):
            return
        self.buf_node = None

        self.listwin = LIST("frain", self.FrainListGetRootsHook)
        self.listwin.FREventBind("ListReFreshPost", FrainListRefreshHook)
        self.listwin.FREventBind("ListReFreshPre",  FrainListRefreshPreHook)
        self.listwin.FREventBind("ListShow",        FrainListShowHook)

        self.listwin.show()
        pyvim.addevent("BufEnter", self.find)
        pyvim.addevent("BufNewFile", self.bufnewfile)
        pyvim.addevent("BufNew", self.bufnew)
Example #9
0
    def __init__(self, buf, linenu, prefix = ''):
        self.linenu = linenu
        self.Buffer = buf

        self.col = len(prefix) + 1

        vim.Function("matchaddpos")("TODO", [[1, 1, self.col - 1]], 11)

        self.Buffer.BFb[linenu] = "%s " % prefix

        self.prefix_len = len(prefix)

        self.IM = EnterLineIM()
        self.IM.enter = self

        self.last_content = ""

        self.handle1 = pyvim.addevent("CursorMovedI", self.cursor_moved,
                self.Buffer.BFb)
        #self.handle2 = pyvim.addevent("InsertLeave", self.quit,
        #        self.Buffer.b)

        vim.current.window.cursor = (1, 999)
        vim.command("startinsert!")
Example #10
0
 def show(self):
     self.win.show()
     Item.lswin = self.win
     pyvim.addevent('CursorMoved', self.update_status, self.win.b)
Example #11
0
 def show(self):
     self.BFCreate()
     pyvim.addevent("CursorMovedI", self.update_status, self.BFb)
Example #12
0
def FrainListShowHook(listwin):
    def vimleave():
        Project.emit("FrainLeave")

    pyvim.addevent('BufWritePost', libpath.push)
    pyvim.addevent('VimLeave',  vimleave)