Skip to content

Commit

Permalink
feat: add an unpatch() function
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Dec 5, 2021
1 parent a0196a4 commit 6487acd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/dressing/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@ M.setup = function(opts)
config.update(opts)
end

local original_input
local original_select

M.patch = function()
-- For Neovim before 0.6
if not vim.ui then
vim.ui = {}
end
if not original_input then
original_input = vim.ui.input
original_select = vim.ui.select
end
vim.ui.input = require("dressing.input")
vim.ui.select = require("dressing.select")
end

M.unpatch = function()
vim.ui.input = original_input
vim.ui.select = original_select
end

return M

0 comments on commit 6487acd

Please sign in to comment.