vim: add feedback for lua executor
This is useful when executing lines that produce no output, so I have some confidence that something actually happened when pressing the key bindings. I am printing the message before executing the command because otherwise this feedback would shadow the output of the command being executed (which I am presumably interested in and would serve itself as feedback).
This commit is contained in:
parent
8cb0e94698
commit
38476f668c
1 changed files with 4 additions and 1 deletions
|
@ -3,13 +3,16 @@ vim.bo.tabstop = 2
|
||||||
local buffer = { buffer = true }
|
local buffer = { buffer = true }
|
||||||
|
|
||||||
local exec_current_lua_line = function()
|
local exec_current_lua_line = function()
|
||||||
vim.fn.luaeval(vim.fn.getline('.'))
|
local lineno = vim.fn.line('.')
|
||||||
|
print('Executing line ' .. lineno)
|
||||||
|
vim.fn.luaeval(vim.fn.getline(lineno))
|
||||||
end
|
end
|
||||||
|
|
||||||
local exec_current_lua_selection = function()
|
local exec_current_lua_selection = function()
|
||||||
local selection = { vim.fn.line('v'), vim.fn.line('.') }
|
local selection = { vim.fn.line('v'), vim.fn.line('.') }
|
||||||
local first, last = vim.fn.min(selection), vim.fn.max(selection)
|
local first, last = vim.fn.min(selection), vim.fn.max(selection)
|
||||||
local code = vim.fn.join(vim.fn.getline(first, last), '\n')
|
local code = vim.fn.join(vim.fn.getline(first, last), '\n')
|
||||||
|
print('Executing lines ' .. first .. ' to ' .. last)
|
||||||
loadstring(code)()
|
loadstring(code)()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue