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:
Folke Lemaitre
2024-11-07 15:54:47 +01:00
committed by GitHub
parent 75750be1c0
commit 2f4697443c
29 changed files with 277 additions and 1066 deletions

View File

@ -71,31 +71,6 @@ function M.extra_idx(name)
end
function M.lazy_file()
-- This autocmd will only trigger when a file was loaded from the cmdline.
-- It will render the file as quickly as possible.
vim.api.nvim_create_autocmd("BufReadPost", {
once = true,
callback = function(event)
-- Skip if we already entered vim
if vim.v.vim_did_enter == 1 then
return
end
-- Try to guess the filetype (may change later on during Neovim startup)
local ft = vim.filetype.match({ buf = event.buf })
if ft then
-- Add treesitter highlights and fallback to syntax
local lang = vim.treesitter.language.get_lang(ft)
if not (lang and pcall(vim.treesitter.start, event.buf, lang)) then
vim.bo[event.buf].syntax = ft
end
-- Trigger early redraw
vim.cmd([[redraw]])
end
end,
})
-- Add support for the LazyFile event
local Event = require("lazy.core.handler.event")