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
def __init__(self): ui_list = LIST("FM List", self.fm_mail_list, ft='fmindex', use_current_buffer=True, title='FM List') self.ui_list = ui_list g.ui_list = ui_list
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)
def Mail(): b = vim.current.buffer if len(b) != 1: return if not fm.conf.mbox: return ui_mbox = LIST("FM Mbox", fm_mbox_list, title=fm.conf.me) ui_mbox.show() ui_mbox.refresh() g.ui_mbox = ui_mbox g.maillist = MailList() if g.default: g.default.node_open()
class FrainList(Events): @classmethod def get_instance(cls): if hasattr(cls, '_instance'): return cls._instance def __new__(cls, *args, **kw): if not hasattr(FrainList, '_instance'): orig = super(FrainList, cls) FrainList._instance = orig.__new__(cls, *args, **kw) return FrainList._instance 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) def bufnew(self): log.error("BufNew") if self.buf_node: self.buf_node.refresh() def bufnewfile(self): path = vim.current.buffer.name dirname = os.path.dirname(path) basename = os.path.basename(path) if BufNewFile.get(dirname): BufNewFile.get(dirname).append(basename) else: BufNewFile[dirname] = [basename] def find(self): if vim.current.buffer.options[ 'buftype' ] != '': return -1 if vim.current.buffer.name == '': return -1 """显示当前的 buffer 对应的文件在 win list 中的位置 如果, buffer 不属于任何一个 project, 返回 `NROOT' 之后生成当前 buffer 在 win list 中的 url, 由 win list 进行查询. """ path = utils.bufferpath() if not path: return for p in Project.All: if path.startswith(p.root): break else: return names = utils.getnames(p.root, path) self.listwin.find(names) def add(self, path, name = ''): "增加一个新的 project, 提供参数 path, name" path = libpath.realpath(path) if not path: return if not name: name = libpath.basename(path) if path: Project(path, name) self.listwin.refresh() def add_cur_path(self): path = utils.bufferpath() self.add(path, '') def cur_project(self): "返回当前 bufferf 所有在 project 对象" path = utils.bufferpath() for p in Project.All: if path.startswith(p.root): return p