Files
LazyVim/lua/lazyvim/util/deprecated.lua
Folke Lemaitre 2f4697443c feat(core)!: move a bunch of LazyVim features to snacks.nvim (#4706)
## Description

LazyVim comes with a bunch of smaller QoL plugin like features, but it's
not easy for non LazyVim users to use them.

That's why I started working on
[snacks.nvim](https://github.com/folke/snacks.nvim), a collection of
small QoL plugins for Neovim.

Snacks also includes a bunch of new improvements to these features.

This PR fully integrates with snacks.

## Todo

- [ ] add proper deprecations where needed
- [ ] create snacks docs
- [ ] document all the new improvements relevant to LazyVim users

## Closes

- [ ] #4492 
- [ ] #4333
- [ ] #4687

## Screenshots

<!-- Add screenshots of the changes if applicable. -->

## Checklist

- [ ] I've read the
[CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md)
guidelines.
2024-11-07 15:54:47 +01:00

60 lines
1.3 KiB
Lua

local M = {}
M.moved = {
lsp = {
rename_file = { "Snacks.rename.rename_file" },
on_rename = { "Snacks.rename.on_rename_file" },
words = { "Snacks.words" },
},
terminal = {
open = { "Snacks.terminal" },
__call = { "Snacks.terminal" },
},
ui = {
statuscolumn = { "Snacks.statuscolumn" },
bufremove = { "Snacks.bufdelete" },
},
}
---@param name string
---@param mod table
function M.decorate(name, mod)
if not M.moved[name] then
return mod
end
setmetatable(mod, {
__call = function(_, ...)
local to = M.moved[name].__call[1]
LazyVim.deprecate("LazyVim." .. name, to)
local ret = vim.tbl_get(_G, unpack(vim.split(to, ".", { plain = true })))
return ret(...)
end,
__index = function(_, k)
if M.moved[name][k] then
local to = M.moved[name][k][1]
LazyVim.deprecate("LazyVim." .. name .. "." .. k, to)
local ret = vim.tbl_get(_G, unpack(vim.split(to, ".", { plain = true })))
return ret
end
return nil
end,
})
end
function M.lazygit()
LazyVim.deprecate("LazyVim.lazygit", "Snacks.lazygit")
return Snacks.lazygit
end
function M.toggle()
LazyVim.deprecate("LazyVim.toggle", "Snacks.toggle")
return {
map = function() end,
wrap = function()
return {}
end,
}
end
return M