Example #1
0
def MailSavePath():
    node = g.ui_list.getnode()
    if not node:
        return

    if not node.ctx:
        return

    mail = node.ctx
    path = mail.path

    #line = vim.current.buffer[-1]
    #if line[0] != '=':
    #    return

    #path = line[1:]

    #vim.command('silent !echo %s' % path)
    #vim.command('redraw!')

    f = os.environ.get('mail_path')
    if not f:
        return

    open(f, 'w').write(path)

    pyvim.echo('save mail path to %s' % f)
Example #2
0
def leaf_delete(leaf):
    if not vim.vars.get('wiki_del_enable'):
        pyvim.echo('Please let g:wiki_del_enable=1')
        return
    url = URL_PUT % (SERVER, leaf.ctx)
    res = requests.request('delete', url)
    leaf.father.refresh()
Example #3
0
    def load_source(self, path):
        if not path.endswith(".py"):
            return

        sys_name = path.replace('.', '_')

        try:
            module_loaded = imp.load_source(sys_name, path)
        except:
            pyvim.echo("Load [%s] Fail"% path)
            import traceback
            logging.error(traceback.format_exc())
Example #4
0
File: run.py Project: fengidri/wind
def Run():
    line = vim.current.line
    line = line.split('$', 1)

    if len(line) != 2:
        pyvim.echo('Not Found Cmd')
        return

    cmd = line[1]

    f = os.popen(cmd)
    pyvim.echo('Run: %s' % (cmd,))
Example #5
0
def FileFilter():
    name = vim.current.buffer.name
    root = None
    for r in pyvim.Roots:
        if not name or name.startswith(r):
            root = r
            break

    if root:
        file_filter(root)
    else:
        pyvim.echo("Not Found root in pyvim.Roots for current file.", hl=True)
Example #6
0
    def load_tex(self, ID_s):
        tmp = self.map_id_tmp_file.get(ID_s)
        if tmp:
            return tmp

        url = URL_CHAPTER % (SERVER, ID_s)
        req = urllib2.Request(url)
        try:
            res = urllib2.urlopen(req).read()
        except Exception, e:
            pyvim.echo(e)
            return
Example #7
0
def MailSend():
    vim.command("update")

    path = vim.current.buffer.name

    ret = fm.sendmail(path)

    if ret:
        vim.command('set buftype=nofile')
        pyvim.echo('send success')
        return

    pyvim.echo('send fail')
Example #8
0
def _align(lines):
    cols = 99999

    for l in lines:
        cols = min(cols, len(l))

    for l in lines:
        l.cols = cols;

    if cols < 2:
        pyvim.echo("cols %d", cols)
        return

    for i in range(cols):
        _align_col([l[i] for l in lines if l.cols])
Example #9
0
def WikiPost():
    if not TEXLIST: return

    remote = Remote()
    curfile = vim.current.buffer.name

    ID_i = remote.post_tex('\n'.join(vim.current.buffer), curfile)

    if ID_i < 0:
        pyvim.echo("POST error: %d" % ID_i)
        return

    remote.update(ID_i, curfile)
    TEXLIST.refresh()
    find(curfile)
Example #10
0
def FileFilter():
    if file_filter.INSTANCE:
        file_filter.INSTANCE.show()
        return


    name = vim.current.buffer.name
    root = None
    for r in pyvim.Roots:
        if not name or name.startswith(r):
            root = r
            break

    if root:
        file_filter(root)
    else:
        pyvim.echo("Not Found root in pyvim.Roots for current file.", hl=True)
Example #11
0
    def load_list(self):
        try:
            response = urllib2.urlopen(URL_INDEX)
            info = response.read()
            info = json.loads(info)
        except:
            pyvim.echo("load index.json fail!")
            info = {}

        for v in info.values():
            if not v.get('title'):
                v['title'] = 'undefined'

            if not v.get('post'):
                v['post'] = '1'

        self.info = info