Page MenuHomePhorge

prompt.lua
No OneTemporary

prompt.lua

-- The prefix that will be before the search text for the user
local prompt_prefix = ">> "
local prompt = {}
prompt.value = ""
prompt.text = function()
return prompt.value
end
prompt.update = function()
vim.notify(prompt_prefix .. prompt.text())
end
prompt.input = function(char)
if char == "BACKSPACE" then
prompt.value = string.sub(prompt.value, 0, -2)
elseif char == "\\\\" then
prompt.value = prompt.value .. "\\"
else
prompt.value = prompt.value .. char
end
prompt.update()
end
prompt.set = function(value)
prompt.value = value
prompt.update()
end
prompt.destroy = function()
prompt.value = ""
vim.notify ""
end
return prompt

File Metadata

Mime Type
text/plain
Expires
Apr 6 2026, 5:55 PM (5 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16043
Default Alt Text
prompt.lua (673 B)

Event Timeline