nvim-libmodal/examples/lua/prompt-callback.lua
Iron-E afdfadf365
ref: use Neovim 0.5
BREAKING CHANGE: now requires Neovim 0.5
2021-07-07 14:25:53 -04:00

22 lines
551 B
Lua

-- Imports
local libmodal = require 'libmodal'
local cmd = vim.api.nvim_command
-- The list of commands. Providing this will allow for autocomplete.
local commandList = {'new', 'close', 'last'}
-- The function which will be called whenever the user enters a command.
function FooMode()
local userInput = vim.g.fooModeInput
if userInput == 'new' then
cmd 'tabnew'
elseif userInput == 'close' then
cmd 'tabclose'
elseif userInput == 'last' then
cmd 'tablast'
end
end
-- Enter the prompt.
libmodal.prompt.enter('FOO', FooMode, commandList)