Ejemplo n.º 1
0
def oc_send_current_buffer():
    # send iskeyword so we can be smarter on what is considered a word
    oc_core_eval("current_iskeyword " + vim.eval("&iskeyword"))
    # this approach takes around 0.8 to 1.8 ms for 3700 - 6751 line file that
    # is 180 to 208 KB, which is acceptable for now
    oc_core_eval("buffer_contents_follow 1")
    return oc_core_eval('\n'.join(vim.current.buffer))
Ejemplo n.º 2
0
def oc_update_current_buffer_info():
    # let server know what is the current buffer
    b = vim.current.buffer
    oc_core_eval('current_buffer_id ' + str(b.number))
    # send server the contents of the current line the cursor is at
    oc_core_eval('current_line ' + vim.current.line)
    # tell server what the current cursor position is
    w = vim.current.window
    cursor_pos = str(w.cursor[0]) + ' ' + str(w.cursor[1])
    oc_core_eval('cursor_position ' + cursor_pos)

    # send current directory to server in preparation for sending tags
    oc_core_eval("current_directory " + vim.eval('getcwd()'))
    # send tags we are using to the server
    oc_core_eval("current_tags " + vim.eval("&tags"))
Ejemplo n.º 3
0
def oc_prune_buffers():
    valid_buffers = []
    for buffer in vim.buffers:
        num = str(buffer.number)
        if vim.eval('buflisted(' + num + ')') == '0':
            continue
        valid_buffers.append(num)

    active_buffer_list = ','.join(valid_buffers)

    return oc_core_eval('prune_buffers ' + active_buffer_list)
Ejemplo n.º 4
0
def oc_prune():
    return oc_core_eval('prune 1')
Ejemplo n.º 5
0
def oc_eval(cmd):
    return oc_core_eval(cmd)