An if_lua
compatibility layer for Neovim (WIP, needs testing)
Maintain some amount of compatibility with the existing Vim interface for Lua (see also: neovim/neovim#12537).
Items annotated with an asterisk *
are only partially supported.
- *
vim.list()
(actually a Lua table,luaeval()
just makes a copy and transforms it into a Vim list...)-
#l
-
l[k]
-
l()
-
table.insert(l, newitem)
-
table.insert(l, position, newitem)
-
table.remove(l, position)
-
l:add(item)
-
l:insert(item[, pos])
-
- *
vim.dict()
(actually a Lua table,luaeval()
just makes a copy and transforms it into a Vim dict...)- *
#d
(Only works with Lua 5.2+ or LuaJIT built with 5.2 extensions) -
d.key
ord['key']
-
d()
- *
- *
vim.blob()
(actually a Lua table)- *
#b
(Only works with Lua 5.2+ or LuaJIT built with 5.2 extensions) -
b[k]
-
b:add(bytes)
- *
-
vim.funcref()
(exists in Neovim core, but the implementation is different here)- *
#f
(Only works with Lua 5.2+ or LuaJIT built with 5.2 extensions) -
f(...)
- *
-
vim.buffer()
-
b()
- *
#b
(Only works with Lua 5.2+ or LuaJIT built with 5.2 extensions) -
b[k]
-
b.name
-
b.fname
-
b.number
-
b:insert(newline[, pos])
-
b:next()
-
b:previous()
-
b:isvalid()
-
-
vim.window()
-
w()
-
w.buffer
-
w.line
(get and set) -
w.col
(get and set) -
w.width
(get and set) -
w.height
(get and set) -
w:next()
-
w:previous()
-
w:isvalid()
-
-
vim.type()
-
list
-
dict
-
blob
-
funcref
-
buffer
-
window
-
-
vim.command()
(alias tovim.api.nvim_command()
) - *
vim.eval()
(alias tovim.api.nvim_eval()
, doesn't actually return avim.list/dict/blob
) -
vim.line()
(alias tovim.api.nvim_get_current_line()
) -
vim.beep()
-
vim.open()
-
vim.call()
(in Neovim core) -
vim.fn()
(in Neovim core)