mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
feat: an extra for mini.snippets. Review folke: document mappings.stop = esc
This commit is contained in:
parent
1bd6356975
commit
ba6364a6ca
1 changed files with 37 additions and 30 deletions
|
|
@ -9,21 +9,15 @@ if lazyvim_docs then
|
|||
-- Also, those completions do not appear when using luasnip or native snippets
|
||||
--
|
||||
-- Set to `false` to enable completion suggestions directly after inserting a snippet
|
||||
vim.g.lazyvim_mini_snippets_expand_insert_override = true
|
||||
vim.g.lazyvim_mini_snippets_override_expand_insert = true
|
||||
|
||||
-- NOTE: Please also read:
|
||||
-- https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-snippets.md#expand
|
||||
-- :h MiniSnippets-session
|
||||
end
|
||||
|
||||
local include_in_completion = vim.g.lazyvim_mini_snippets_in_completion == nil
|
||||
or vim.g.lazyvim_mini_snippets_in_completion
|
||||
local override_expand_insert = vim.g.lazyvim_mini_snippets_expand_insert_override == nil
|
||||
or vim.g.lazyvim_mini_snippets_expand_insert_override
|
||||
|
||||
--[[
|
||||
Example override for your own config:
|
||||
return {
|
||||
-- Example override for your own config:
|
||||
--[[
|
||||
return {
|
||||
{
|
||||
"echasnovski/mini.snippets",
|
||||
opts = function(_, opts)
|
||||
|
|
@ -45,8 +39,14 @@ return {
|
|||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
}
|
||||
--]]
|
||||
end
|
||||
|
||||
local include_in_completion = vim.g.lazyvim_mini_snippets_in_completion == nil
|
||||
or vim.g.lazyvim_mini_snippets_in_completion
|
||||
local override_expand_insert = vim.g.lazyvim_mini_snippets_override_expand_insert == nil
|
||||
or vim.g.lazyvim_mini_snippets_override_expand_insert
|
||||
|
||||
local function expand_from_lsp(snippet)
|
||||
local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert
|
||||
|
|
@ -90,6 +90,13 @@ return {
|
|||
local mini_snippets = require("mini.snippets")
|
||||
return {
|
||||
snippets = { mini_snippets.gen_loader.from_lang() },
|
||||
|
||||
-- Following the behavior of vim.snippets,
|
||||
-- the intended usage of <esc> is to be able to temporarily exit into normal mode for quick edits.
|
||||
--
|
||||
-- If you'd rather stop the snippet on <esc>, activate the line below in your own config:
|
||||
-- mappings = { stop = "<esc>" }, -- <c-c> by default, see :h MiniSnippets-session
|
||||
|
||||
expand = {
|
||||
select = function(snippets, insert)
|
||||
-- Close completion window on snippet select - vim.ui.select
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue