Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F131202
controller.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
controller.lua
View Options
local
window
=
require
"ivy.window"
local
prompt
=
require
"ivy.prompt"
local
controller
=
{}
controller
.
items
=
nil
controller
.
callback
=
nil
controller
.
run
=
function
(
name
,
items
,
callback
)
controller
.
callback
=
callback
controller
.
items
=
items
window
.
initialize
()
window
.
set_items
{
"-- Loading ---"
}
vim
.
api
.
nvim_buf_set_name
(
window
.
get_buffer
(),
name
)
controller
.
input
""
end
controller
.
input
=
function
(
char
)
prompt
.
input
(
char
)
controller
.
update
(
prompt
.
text
())
end
controller
.
search
=
function
(
value
)
prompt
.
set
(
value
)
controller
.
update
(
prompt
.
text
())
end
controller
.
update
=
function
(
text
)
vim
.
schedule
(
function
()
window
.
set_items
(
controller
.
items
(
text
))
vim
.
cmd
(
"syntax clear IvyMatch"
)
vim
.
cmd
(
"syntax match IvyMatch '[("
..
text
..
")]'"
)
end
)
end
controller
.
complete
=
function
()
controller
.
checkpoint
()
controller
.
destroy
()
end
controller
.
checkpoint
=
function
()
vim
.
api
.
nvim_set_current_win
(
window
.
origin
)
controller
.
callback
(
window
.
get_current_selection
())
vim
.
api
.
nvim_set_current_win
(
window
.
window
)
end
controller
.
next
=
function
()
local
max
=
vim
.
api
.
nvim_buf_line_count
(
window
.
buffer
)
-
1
if
window
.
index
==
max
then
return
end
window
.
index
=
window
.
index
+
1
window
.
update
()
end
controller
.
previous
=
function
()
if
window
.
index
==
0
then
return
end
window
.
index
=
window
.
index
-
1
window
.
update
()
end
controller
.
origin
=
function
()
return
vim
.
api
.
nvim_win_get_buf
(
window
.
origin
)
end
controller
.
destroy
=
function
()
controller
.
items
=
nil
controller
.
callback
=
nil
window
.
destroy
()
prompt
.
destroy
()
end
return
controller
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Apr 6 2026, 5:16 PM (5 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16047
Default Alt Text
controller.lua (1 KB)
Attached To
Mode
R1 ivy.nvim
Attached
Detach File
Event Timeline
Log In to Comment