feat: add the paste functionality into the ivy prompt
Now when you paste and you are in an ivy buffer the paste will be added to the prompt not into the completion window. You can use your usual paste key binding I.E. <SHIFT>+<INSERT> <CTRL>+<SHIFT>+<V> Ref: #11
This commit is contained in:
parent
0bd6770da4
commit
5a0f037b71
2 changed files with 15 additions and 1 deletions
|
|
@ -30,6 +30,10 @@ controller.search = function(value)
|
||||||
controller.update(prompt.text())
|
controller.update(prompt.text())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
controller.paste = function()
|
||||||
|
controller.search(prompt.text() .. vim.fn.getreg "+p")
|
||||||
|
end
|
||||||
|
|
||||||
controller.update = function(text)
|
controller.update = function(text)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
window.set_items(controller.items(text))
|
window.set_items(controller.items(text))
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,17 @@ local register_backend = function(backend)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
register_backend(require "ivy.backends.ag")
|
vim.paste = (function(overridden)
|
||||||
|
return function(lines, phase)
|
||||||
|
local file_type = vim.api.nvim_buf_get_option(0, "filetype")
|
||||||
|
if file_type == "ivy" then
|
||||||
|
vim.ivy.paste()
|
||||||
|
else
|
||||||
|
overridden(lines, phase)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)(vim.paste)
|
||||||
|
|
||||||
register_backend(require "ivy.backends.buffers")
|
register_backend(require "ivy.backends.buffers")
|
||||||
register_backend(require "ivy.backends.files")
|
register_backend(require "ivy.backends.files")
|
||||||
register_backend(require "ivy.backends.lines")
|
register_backend(require "ivy.backends.lines")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue