Summary:
Now when using ivy.nvim you will need to call the `setup` function. This will
need to register any backends you want to use. This is an example config, this
can be put into a plugin in `~/.config/nvim/plugin/ivy.lua` for example.
```lua
require('ivy').setup {
backends = {
"ivy.backends.buffers",
"ivy.backends.files",
},
}
```
If you are using Lazy you can use the `config` directly to call the setup
function.
```lua
return {
"AdeAttwood/ivy.nvim",
build = "cargo build --release",
config = {
backends = {
"ivy.backends.buffers",
"ivy.backends.files",
}
}
}
```
The `setup` function can only be called once, if its called a second time any
backends or config will not be used. The module does expose the
`register_backend` function, this can be used to load backends before or after
the setup function is called.
```lua
require('ivy').register_backend("ivy.backends.files")
```
As well as the `register_backend` the core `run`function is exposed. With this
exposed we should be able to build anything we want.
```lua
vim.ivy.run(
"Title",
function(input)
return {
{ content = "One" },
{ content = "Two" },
{ content = "Three" },
}
end,
function(result) vim.cmd("edit " .. result) end
)
```
Test Plan:
Not much to test in this one, it has been tested locally on my config that does
not use any plugin managers, also a sandbox Lazy env using `NVIM_APPNAME`
NVIM_APPNAME
19 lines
547 B
Lua
19 lines
547 B
Lua
local controller = require "ivy.controller"
|
|
|
|
-- Put the controller in to the vim global so we can access it in mappings
|
|
-- better without requires. You can call controller commands like `vim.ivy.xxx`.
|
|
-- luacheck: ignore
|
|
vim.ivy = controller
|
|
|
|
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)
|
|
|
|
vim.cmd "highlight IvyMatch cterm=bold gui=bold"
|