Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
195 lines
3.7 KiB
Python
195 lines
3.7 KiB
Python
# vim:set et sw=4 ts=8:
|
|
import vim
|
|
|
|
# vim's python binding doesn't have the `call` method, wrap it here
|
|
|
|
|
|
def nvim_call_function(method, args):
|
|
vim.vars['_neovim_rpc_tmp_args'] = args
|
|
# vim.eval('getcurpos()') return an array of string, it should be an array
|
|
# of int. Use json_encode to workaround this
|
|
return vim.bindeval('call("%s",g:_neovim_rpc_tmp_args)' % method)
|
|
|
|
|
|
def nvim_get_current_buf():
|
|
return vim.current.buffer
|
|
|
|
|
|
def nvim_list_bufs():
|
|
return list(vim.buffers)
|
|
|
|
|
|
def nvim_buf_get_number(buf):
|
|
return buf.number
|
|
|
|
|
|
def nvim_buf_get_name(buffer):
|
|
return buffer.name
|
|
|
|
|
|
def nvim_get_var(name):
|
|
return vim.vars[name]
|
|
|
|
|
|
def nvim_get_vvar(name):
|
|
return vim.vvars[name]
|
|
|
|
|
|
def nvim_set_var(name, val):
|
|
vim.vars[name] = val
|
|
return val
|
|
|
|
|
|
def nvim_buf_get_var(buffer, name):
|
|
return buffer.vars[name]
|
|
|
|
|
|
def nvim_buf_set_var(buffer, name, val):
|
|
buffer.vars[name] = val
|
|
|
|
|
|
def nvim_buf_get_lines(buffer, start, end, *args):
|
|
if start < 0:
|
|
start = len(buffer) + 1 + start
|
|
if end < 0:
|
|
end = len(buffer) + 1 + end
|
|
return buffer[start:end]
|
|
|
|
|
|
def nvim_eval(expr):
|
|
return nvim_call_function('eval', [expr])
|
|
|
|
|
|
def nvim_buf_set_lines(buffer, start, end, err, lines):
|
|
if start < 0:
|
|
start = len(buffer) + 1 + start
|
|
if end < 0:
|
|
end = len(buffer) + 1 + end
|
|
buffer[start:end] = lines
|
|
|
|
if nvim_call_function('bufwinnr', [buffer.number]) != -1:
|
|
# vim needs' redraw to update the screen, it seems to be a bug
|
|
vim.command('redraw')
|
|
|
|
|
|
buffer_set_lines = nvim_buf_set_lines
|
|
|
|
|
|
def buffer_line_count(buffer):
|
|
return len(buffer)
|
|
|
|
|
|
def nvim_buf_line_count(buffer):
|
|
return len(buffer)
|
|
|
|
|
|
def nvim_get_option(name):
|
|
return vim.options[name]
|
|
|
|
|
|
def nvim_buf_get_option(buf, name):
|
|
return buf.options[name]
|
|
|
|
|
|
def nvim_set_option(name, val):
|
|
vim.options[name] = val
|
|
|
|
|
|
def nvim_buf_set_option(buf, name, val):
|
|
buf.options[name] = val
|
|
|
|
|
|
def nvim_command(cmd):
|
|
vim.command(cmd)
|
|
|
|
|
|
def nvim_get_current_line():
|
|
return vim.current.line
|
|
|
|
|
|
def nvim_get_current_win():
|
|
return vim.current.window
|
|
|
|
|
|
def nvim_win_get_cursor(window):
|
|
return window.cursor
|
|
|
|
|
|
def nvim_win_get_buf(window):
|
|
return window.buffer
|
|
|
|
|
|
def nvim_win_get_width(window):
|
|
return window.width
|
|
|
|
|
|
def nvim_win_set_width(window, width):
|
|
window.width = width
|
|
|
|
|
|
def nvim_win_get_height(window):
|
|
return window.height
|
|
|
|
|
|
def nvim_win_set_height(window, height):
|
|
window.height = height
|
|
|
|
|
|
def nvim_win_get_var(window, name):
|
|
return window.vars[name]
|
|
|
|
|
|
def nvim_win_set_var(window, name, val):
|
|
window.vars[name] = val
|
|
|
|
|
|
def nvim_win_get_option(window, name):
|
|
return window.options[name]
|
|
|
|
|
|
def nvim_win_set_option(window, name, val):
|
|
window.options[name] = val
|
|
|
|
|
|
def nvim_win_get_position(window):
|
|
return (window.row, window.col)
|
|
|
|
|
|
def nvim_win_get_number(window):
|
|
return window.number
|
|
|
|
|
|
def nvim_win_is_valid(window):
|
|
return window.valid
|
|
|
|
|
|
def nvim_out_write(s):
|
|
nvim_call_function('neovim_rpc#_nvim_out_write', [s])
|
|
|
|
|
|
def nvim_err_write(s):
|
|
nvim_call_function('neovim_rpc#_nvim_err_write', [s])
|
|
|
|
|
|
def nvim_buf_add_highlight(buf, src_id, *args):
|
|
# https://github.com/autozimu/LanguageClient-neovim/pull/151#issuecomment-339198527
|
|
# FIXME
|
|
return src_id
|
|
|
|
|
|
def nvim_buf_clear_highlight(*args):
|
|
# https://github.com/autozimu/LanguageClient-neovim/pull/151#issuecomment-339198527
|
|
# FIXME
|
|
pass
|
|
|
|
|
|
def nvim_set_client_info(*args):
|
|
# https://github.com/roxma/vim-hug-neovim-rpc/issues/61
|
|
vim.vars['_neovim_rpc_client_info'] = args
|
|
|
|
|
|
def nvim_get_client_info():
|
|
if '_neovim_rpc_client_info' not in vim.vars:
|
|
return []
|
|
return vim.vars['_neovim_rpc_client_info']
|