Replies: 2 comments 5 replies
-
You can create an issue. For some reason, Snacks.picker.lsp_definitions {
on_show = function(picker)
-- picker.input:stopinsert() -- Doesn't work even within `vim.schedule`
vim.api.nvim_input '<Esc>'
end,
} |
Beta Was this translation helpful? Give feedback.
5 replies
-
I was not able to reproduce with the following minimal repro -- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/dpetka2001/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
{
"folke/lazydev.nvim",
ft = "lua",
cmd = "LazyDev",
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
{ path = "snacks.nvim", words = { "Snacks" } },
},
},
},
{
"mason-org/mason-lspconfig.nvim",
opts = {
ensure_installed = { "lua_ls" },
},
dependencies = {
{ "mason-org/mason.nvim", opts = {} },
"neovim/nvim-lspconfig",
},
},
{
"folke/snacks.nvim",
opts = {
picker = {},
},
},
},
})
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("test", {}),
desc = "Lsp mappings",
callback = function()
vim.keymap.set("n", "gd", function()
Snacks.picker.lsp_definitions({
on_show = function()
vim.cmd.stopinsert()
end,
})
end)
end,
}) It works as expected for me and puts the picker in Here's also a screencast of the whole procedure Screencast_20250707_103151.webm |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Have this code that doesn't put me in normal mode when pressing
gd
:Does this specific picker not support this functionality?
Beta Was this translation helpful? Give feedback.
All reactions