ivy.nvim/plugin/ivy.lua
Ade Attwood ded926a4a6
All checks were successful
CI / Luacheck (pull_request) Successful in 20s
CI / StyLua (pull_request) Successful in 12s
CI / Cargo Format (pull_request) Successful in 18s
CI / Build and test (pull_request) Successful in 2m2s
Conventional Tools Commitlint / Commitlint (pull_request) Successful in 4s
CI / Luacheck (push) Successful in 22s
CI / StyLua (push) Successful in 12s
CI / Cargo Format (push) Successful in 18s
CI / Build and test (push) Successful in 1m52s
Conventional Tools Commitlint / Commitlint (push) Successful in 5s
chore: make public api consistent
Summary:

Right now we have two ways to access the public api we have `require('ivy')`
and `vim.ivy. Each way has a different api that will cause some confusion.

Now both apis are the same so anyone that wants to integrate with ivy can do so
without having to figure out what one they need to use.

Test Plan:

The unit tests cover most of the work, I have also been using this locally for
quite some time now with now issues.
2024-09-03 19:34:17 +01:00

19 lines
522 B
Lua

local api = require "ivy"
-- 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 = api
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"