aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/lua')
-rw-r--r--src/nvim/lua/treesitter.c2
-rw-r--r--src/nvim/lua/vim.lua13
-rw-r--r--src/nvim/lua/xdiff.c6
3 files changed, 12 insertions, 9 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index bd978cc8ab..02bd612149 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -934,7 +934,7 @@ push:
ts_tree_cursor_current_node(ud),
lua_upvalueindex(2)); // [node]
- const char * field = ts_tree_cursor_current_field_name(ud);
+ const char *field = ts_tree_cursor_current_field_name(ud);
if (field != NULL) {
lua_pushstring(L, ts_tree_cursor_current_field_name(ud));
diff --git a/src/nvim/lua/vim.lua b/src/nvim/lua/vim.lua
index 51b7430957..30c7034209 100644
--- a/src/nvim/lua/vim.lua
+++ b/src/nvim/lua/vim.lua
@@ -323,22 +323,25 @@ end
do
local validate = vim.validate
- local function make_dict_accessor(scope)
+ local function make_dict_accessor(scope, handle)
validate {
scope = {scope, 's'};
}
local mt = {}
function mt:__newindex(k, v)
- return vim._setvar(scope, 0, k, v)
+ return vim._setvar(scope, handle or 0, k, v)
end
function mt:__index(k)
- return vim._getvar(scope, 0, k)
+ if handle == nil and type(k) == 'number' then
+ return make_dict_accessor(scope, k)
+ end
+ return vim._getvar(scope, handle or 0, k)
end
return setmetatable({}, mt)
end
- vim.g = make_dict_accessor('g')
- vim.v = make_dict_accessor('v')
+ vim.g = make_dict_accessor('g', false)
+ vim.v = make_dict_accessor('v', false)
vim.b = make_dict_accessor('b')
vim.w = make_dict_accessor('w')
vim.t = make_dict_accessor('t')
diff --git a/src/nvim/lua/xdiff.c b/src/nvim/lua/xdiff.c
index 3955fbe72c..7eda9b6270 100644
--- a/src/nvim/lua/xdiff.c
+++ b/src/nvim/lua/xdiff.c
@@ -62,7 +62,7 @@ static int hunk_locations_cb(long start_a, long count_a, long start_b, long coun
start_b += 1;
}
- lua_State * lstate = (lua_State *)cb_data;
+ lua_State *lstate = (lua_State *)cb_data;
lua_createtable(lstate, 0, 0);
lua_pushinteger(lstate, start_a);
@@ -93,7 +93,7 @@ static int call_on_hunk_cb(long start_a, long count_a, long start_b, long count_
}
hunkpriv_t *priv = (hunkpriv_t *)cb_data;
- lua_State * lstate = priv->lstate;
+ lua_State *lstate = priv->lstate;
Error *err = priv->err;
const int fidx = lua_gettop(lstate);
lua_pushvalue(lstate, fidx);
@@ -133,7 +133,7 @@ static mmfile_t get_string_arg(lua_State *lstate, int idx)
static bool check_xdiff_opt(ObjectType actType, ObjectType expType, const char *name, Error *err)
{
if (actType != expType) {
- const char * type_str =
+ const char *type_str =
expType == kObjectTypeString ? "string" :
expType == kObjectTypeInteger ? "integer" :
expType == kObjectTypeBoolean ? "boolean" :