mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-23 17:28:57 +02:00
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.
This commit is contained in:
parent
75750be1c0
commit
2f4697443c
29 changed files with 277 additions and 1066 deletions
|
@ -104,7 +104,7 @@ return {
|
|||
vim.api.nvim_create_autocmd("User", {
|
||||
pattern = "MiniFilesActionRename",
|
||||
callback = function(event)
|
||||
LazyVim.lsp.on_rename(event.data.from, event.data.to)
|
||||
Snacks.rename.on_rename_file(event.data.from, event.data.to)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
|
|
|
@ -108,7 +108,7 @@ return {
|
|||
ft = { "markdown", "norg", "rmd", "org" },
|
||||
config = function(_, opts)
|
||||
require("render-markdown").setup(opts)
|
||||
LazyVim.toggle.map("<leader>um", {
|
||||
Snacks.toggle({
|
||||
name = "Render Markdown",
|
||||
get = function()
|
||||
return require("render-markdown.state").enabled
|
||||
|
@ -121,7 +121,7 @@ return {
|
|||
m.disable()
|
||||
end
|
||||
end,
|
||||
})
|
||||
}):map("<leader>um")
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -31,14 +31,6 @@ return {
|
|||
return vim.api.nvim_win_get_config(win).relative == ""
|
||||
end,
|
||||
},
|
||||
{
|
||||
ft = "lazyterm",
|
||||
title = "LazyTerm",
|
||||
size = { height = 0.4 },
|
||||
filter = function(buf)
|
||||
return not vim.b[buf].lazyterm_cmd
|
||||
end,
|
||||
},
|
||||
"Trouble",
|
||||
{ ft = "qf", title = "QuickFix" },
|
||||
{
|
||||
|
@ -103,6 +95,7 @@ return {
|
|||
end
|
||||
end
|
||||
|
||||
-- trouble
|
||||
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
|
||||
opts[pos] = opts[pos] or {}
|
||||
table.insert(opts[pos], {
|
||||
|
@ -116,6 +109,22 @@ return {
|
|||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- snacks terminal
|
||||
for _, pos in ipairs({ "top", "bottom", "left", "right" }) do
|
||||
opts[pos] = opts[pos] or {}
|
||||
table.insert(opts[pos], {
|
||||
ft = "snacks_terminal",
|
||||
size = { height = 0.4 },
|
||||
title = "%{b:snacks_terminal.id}: %{b:term_title}",
|
||||
filter = function(_buf, win)
|
||||
return vim.w[win].snacks_win
|
||||
and vim.w[win].snacks_win.position == pos
|
||||
and vim.w[win].snacks_win.relative == "editor"
|
||||
and not vim.w[win].trouble_preview
|
||||
end,
|
||||
})
|
||||
end
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
|
|
|
@ -21,7 +21,7 @@ return {
|
|||
end,
|
||||
})
|
||||
|
||||
LazyVim.toggle.map("<leader>ua", {
|
||||
Snacks.toggle({
|
||||
name = "Mini Animate",
|
||||
get = function()
|
||||
return not vim.g.minianimate_disable
|
||||
|
@ -29,7 +29,7 @@ return {
|
|||
set = function(state)
|
||||
vim.g.minianimate_disable = not state
|
||||
end,
|
||||
})
|
||||
}):map("<leader>ua")
|
||||
|
||||
local animate = require("mini.animate")
|
||||
return {
|
||||
|
|
|
@ -14,17 +14,19 @@ return {
|
|||
init = function()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = {
|
||||
"Trouble",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"fzf",
|
||||
"help",
|
||||
"lazy",
|
||||
"lazyterm",
|
||||
"mason",
|
||||
"neo-tree",
|
||||
"notify",
|
||||
"snacks_notif",
|
||||
"snacks_terminal",
|
||||
"snacks_win",
|
||||
"toggleterm",
|
||||
"Trouble",
|
||||
"trouble",
|
||||
},
|
||||
callback = function()
|
||||
|
|
|
@ -4,8 +4,7 @@ return {
|
|||
event = "VeryLazy",
|
||||
opts = function()
|
||||
local tsc = require("treesitter-context")
|
||||
|
||||
LazyVim.toggle.map("<leader>ut", {
|
||||
Snacks.toggle({
|
||||
name = "Treesitter Context",
|
||||
get = tsc.enabled,
|
||||
set = function(state)
|
||||
|
@ -15,8 +14,7 @@ return {
|
|||
tsc.disable()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
}):map("<leader>ut")
|
||||
return { mode = "cursor", max_lines = 3 }
|
||||
end,
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@ return {
|
|||
{
|
||||
"<leader>gG",
|
||||
function()
|
||||
LazyVim.terminal.open({ "gitui" }, { esc_esc = false, ctrl_hjkl = false })
|
||||
Snacks.terminal({ "gitui" })
|
||||
end,
|
||||
desc = "GitUi (cwd)",
|
||||
},
|
||||
{
|
||||
"<leader>gg",
|
||||
function()
|
||||
LazyVim.terminal.open({ "gitui" }, { cwd = LazyVim.root.get(), esc_esc = false, ctrl_hjkl = false })
|
||||
Snacks.terminal({ "gitui" }, { cwd = LazyVim.root.get() })
|
||||
end,
|
||||
desc = "GitUi (Root Dir)",
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue