|
|
@ -36,7 +36,7 @@ function api.nvim_echo(str)
|
|
|
|
api.nvim_command("echo " .. tostring(str))
|
|
|
|
api.nvim_command("echo " .. tostring(str))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-----------------------------------
|
|
|
|
------------------------------------
|
|
|
|
--[[ SUMMARY:
|
|
|
|
--[[ SUMMARY:
|
|
|
|
* Check whether or not some variable exists.
|
|
|
|
* Check whether or not some variable exists.
|
|
|
|
]]
|
|
|
|
]]
|
|
|
@ -44,9 +44,9 @@ end
|
|
|
|
* `scope` => The scope of the variable (i.e. `g`, `l`, etc.)
|
|
|
|
* `scope` => The scope of the variable (i.e. `g`, `l`, etc.)
|
|
|
|
* `var` => the variable to check for.
|
|
|
|
* `var` => the variable to check for.
|
|
|
|
]]
|
|
|
|
]]
|
|
|
|
-----------------------------------
|
|
|
|
------------------------------------
|
|
|
|
function api.nvim_exists(scope, var)
|
|
|
|
function api.nvim_exists(scope, var)
|
|
|
|
return api.nvim_eval("exists('" .. scope .. ":" .. var .. "')") == globals.VIM_TRUE
|
|
|
|
return api.nvim_call_function('exists', {scope .. ':' .. var}) == globals.VIM_TRUE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-------------------------
|
|
|
|
-------------------------
|
|
|
@ -68,15 +68,13 @@ end
|
|
|
|
'"endwhile"'
|
|
|
|
'"endwhile"'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return tonumber(vim.api.nvim_eval(
|
|
|
|
return tonumber(vim.api.nvim_call_function("execute",cmd))
|
|
|
|
"execute([" .. table.concat(cmd, ',') .. "])"
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
```
|
|
|
|
```
|
|
|
|
However, I'm not sure if it would accidentally affect text.
|
|
|
|
However, I'm not sure if it would accidentally affect text.
|
|
|
|
]]
|
|
|
|
]]
|
|
|
|
-------------------------
|
|
|
|
-------------------------
|
|
|
|
function api.nvim_input()
|
|
|
|
function api.nvim_input()
|
|
|
|
return api.nvim_eval('getchar()')
|
|
|
|
return api.nvim_call_function('getchar', {})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
---------------------------------
|
|
|
|
---------------------------------
|
|
|
@ -91,11 +89,11 @@ end
|
|
|
|
local resetHighlight = Entry.new('None', '')
|
|
|
|
local resetHighlight = Entry.new('None', '')
|
|
|
|
function api.nvim_lecho(hlTables)
|
|
|
|
function api.nvim_lecho(hlTables)
|
|
|
|
api.nvim_redraw()
|
|
|
|
api.nvim_redraw()
|
|
|
|
table.insert(hlTables, resetHighlight)
|
|
|
|
hlTables[#hlTables+1] = resetHighlight
|
|
|
|
for _, hlTable in ipairs(hlTables) do
|
|
|
|
for _, hlTable in ipairs(hlTables) do
|
|
|
|
api.nvim_command(
|
|
|
|
api.nvim_command(
|
|
|
|
-- `:echohl` the hlgroup and then `:echon` the string.
|
|
|
|
-- `:echohl` the hlgroup and then `:echon` the string.
|
|
|
|
"echohl " .. hlTable.hl .. " | echon '" .. hlTable.str .. "'"
|
|
|
|
"echohl " .. tostring(hlTable.hl) .. " | echon '" .. tostring(hlTable.str) .. "'"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -119,13 +117,14 @@ end
|
|
|
|
* `msg` => the message of the error.
|
|
|
|
* `msg` => the message of the error.
|
|
|
|
]]
|
|
|
|
]]
|
|
|
|
--------------------------------------
|
|
|
|
--------------------------------------
|
|
|
|
|
|
|
|
local returnEntry = Entry.new('Question', '\nPress any key to return.')
|
|
|
|
function api.nvim_show_err(title, msg)
|
|
|
|
function api.nvim_show_err(title, msg)
|
|
|
|
api.nvim_lecho({
|
|
|
|
api.nvim_lecho({
|
|
|
|
Entry.new('Title', title .. '\n'),
|
|
|
|
Entry.new('Title', tostring(title) .. '\n'),
|
|
|
|
Entry.new('Error', msg),
|
|
|
|
Entry.new('Error', tostring(msg)),
|
|
|
|
Entry.new('Question', '\n[Press any key to return]')
|
|
|
|
returnEntry
|
|
|
|
})
|
|
|
|
})
|
|
|
|
api.nvim_command('call getchar()')
|
|
|
|
api.nvim_call_function('getchar', {})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--[[
|
|
|
|
--[[
|
|
|
|