예제 #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)
예제 #2
0
파일: __init__.py 프로젝트: ChellsChen/wind
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()
예제 #3
0
파일: plugins.py 프로젝트: ChellsChen/wind
    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())
예제 #4
0
파일: run.py 프로젝트: 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,))
예제 #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)
예제 #6
0
파일: __init__.py 프로젝트: ChellsChen/wind
    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
예제 #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')
예제 #8
0
파일: align.py 프로젝트: fengidri/wind
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])
예제 #9
0
파일: __init__.py 프로젝트: ChellsChen/wind
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)
예제 #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)
예제 #11
0
파일: __init__.py 프로젝트: ChellsChen/wind
    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