示例#1
0
文件: wind.py 项目: fengidri/wind
def excepthook(type, value, trace):
    if type == KeyboardInterrupt:
        print ""
        return

    pyvim.echoline(">>Error(%s): %s: " % (LOGFILE, type.__name__ + str(value)))
    log.error("Uncaught exception:", exc_info =(type, value, trace))
示例#2
0
文件: GoAny.py 项目: ChellsChen/wind
def showpos(response):
    try:
        linenu = int(response.msg)
    except:
        return
    vim.current.window.cursor = ( linenu, 0 )
    vim.command("normal zt")
    pyvim.redraw()
    pyvim.echoline(response.msg)
示例#3
0
文件: wubi.py 项目: ChellsChen/wind
def search_from_db(patten):
    try:
        r = urllib2.urlopen("http://localhost/wubi/search?patten=%s" %
            patten)
        w = json.loads(r.read())
        cache[patten] = w
        return w
    except Exception, e:
        pyvim.echoline(str(e))
        return ([], [])
示例#4
0
文件: wubi.py 项目: ChellsChen/wind
def setcount(patten, num):
    w, ass = cache.pop(patten)
    if len(w) -1 < num:
        return
    ww = w[num]
    url = "http://localhost/wubi/setcount?patten=%s&word=%s" % (patten,
            ww.encode('utf8'))
    try:
        urllib2.urlopen(url)
    except Exception, e:
        pyvim.echoline(str(e))
示例#5
0
文件: GoAny.py 项目: ChellsChen/wind
def gototag():
    backpos = vim.current.window.cursor

    client = VuiClient()
    client.sethandle(110, showpos)
    client.sethandle(200, showpos)
    client.request("/open/tag", {"values":
        get_file_tag(vim.current.buffer.name)})
    response = client.response()
    if response.code > 200:
        vim.current.window.cursor = backpos
        pyvim.echoline("Quit")
示例#6
0
    def _goto(self, index):
        tag = self.taglist[index]

        g.taglist_cur = self.taglist

        tag.goto()
        TagStack().push(tag)

        g.taglist_cur = None

        pyvim.echoline('Tag(%s) goto %s/%s kind: %s. [%s]' %
                       (tag.tag, index + 1, self.num, tag.kind, g.msg))
示例#7
0
def listdir(path):
    s, o = runssh(path, 'ls -L --color=never -1 -p')
    if s != 0:
        pyvim.echoline('ssh error: %s' % o)
        return None, None
    logging.error(o)

    lines = o.split('\n')
    fs = []
    dirs = []
    for line in lines:
        if line[-1] == '/':
            dirs.append(line[0:-1])
        else:
            fs.append(line)
    return (dirs, fs)
示例#8
0
def listdir(path):
    s, o = runssh(path, "ls -L --color=never -1 -p")
    if s != 0:
        pyvim.echoline("ssh error: %s" % o)
        return None, None
    logging.info(o)

    lines = o.split("\n")
    fs = []
    dirs = []
    for line in lines:
        if line[-1] == "/":
            dirs.append(line[0:-1])
        else:
            fs.append(line)
    return (dirs, fs)
示例#9
0
def FrainAddInclude(path):
    if not FrainList.get_instance():
        return

    project = FrainList().cur_project()
    if not project:
        return

    if not os.path.isdir(path):
        pyvim.echoline('%s is not dir' % path)
        return

    path = os.path.realpath(path)

    project.add_c_include(path)
    Project.update_c_include()
示例#10
0
def Tag(tag=None):
    if not tag:
        tag = pyvim.current_word()

    root = pyvim.get_cur_root()
    if not root:
        pyvim.echoline('not in project path')
        return

    taglist, err = libtag.find_tag(root, tag)
    if not taglist:
        pyvim.echoline(err)
        return

    frame = TagFrame(taglist)

    frame.goto()
示例#11
0
def push(tmp_file, scp_path):
    t = paser(scp_path)
    if not t:
        return
    user, host, path = t

    cmd = 'scp -o ConnectTimeout=3 %s  %s%s:%s ' % ( tmp_file, user, host, path)
    pyvim.echoline('start scp: %s' % scp_path)
    code, o  = commands.getstatusoutput(cmd)
    if code == 0:
        pyvim.echoline('Push success: %s' % scp_path)
    else:
        logging.error(cmd)
        pyvim.echoline('Push fail: %s' % scp_path, hl=True)
示例#12
0
def pull(scp_path, tempfile):
    t = paser(scp_path)
    if not t:
        return
    user, host, path = t

    cmd = "scp -o ConnectTimeout=3 %s%s:%s %s" % (user, host, path, tempfile)
    pyvim.echoline("start scp: %s" % scp_path)
    code, o = commands.getstatusoutput(cmd)
    if code == 0:
        pyvim.echoline("Pull success: %s" % scp_path)
    else:
        logging.error(cmd)
        pyvim.echoline("Pull fail: %s" % scp_path, hl=True)
        return
    return tempfile
示例#13
0
文件: vuirpc.py 项目: ChellsChen/wind
def handle100(response):
    time.sleep(0.2)
    os.system('wmctrl -a VuiRpcQs')
    pyvim.echoline(response.reason)
示例#14
0
文件: GoAny.py 项目: ChellsChen/wind
def showfile(response):
    filepath = response.msg
    vim.command("silent edit %s" % filepath)
    pyvim.redraw()
    pyvim.echoline(filepath)