mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
add: migrate wilder to cmp cmdline
This commit is contained in:
parent
f00438c822
commit
1b1f8b9967
2 changed files with 294 additions and 163 deletions
|
@ -1,20 +1,151 @@
|
|||
return {
|
||||
-- for auto complate commond mode
|
||||
-- {
|
||||
-- "gelguy/wilder.nvim",
|
||||
-- lazy = true,
|
||||
-- event = "VeryLazy",
|
||||
-- config = function()
|
||||
-- local wilder = require("wilder")
|
||||
-- wilder.setup({ modes = { ":", "/", "?" } })
|
||||
-- wilder.set_option(
|
||||
-- "renderer",
|
||||
-- wilder.popupmenu_renderer({
|
||||
-- highlighter = wilder.basic_highlighter(),
|
||||
-- left = { " ", wilder.popupmenu_devicons() },
|
||||
-- right = { " ", wilder.popupmenu_scrollbar() },
|
||||
-- })
|
||||
-- )
|
||||
-- end,
|
||||
-- },
|
||||
{
|
||||
"gelguy/wilder.nvim",
|
||||
"folke/noice.nvim",
|
||||
lazy = true,
|
||||
dependencies = {
|
||||
{ "MunifTanjim/nui.nvim" },
|
||||
},
|
||||
-- event = "BufWinEnter",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
messages = {
|
||||
enabled = false,
|
||||
},
|
||||
notify = {
|
||||
enabled = false,
|
||||
},
|
||||
lsp = {
|
||||
progress = {
|
||||
enabled = false,
|
||||
},
|
||||
hover = {
|
||||
enabled = false,
|
||||
},
|
||||
signature = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<S-Enter>",
|
||||
function()
|
||||
require("noice").redirect(vim.fn.getcmdline())
|
||||
end,
|
||||
mode = "c",
|
||||
desc = "Redirect Cmdline",
|
||||
},
|
||||
{
|
||||
"<leader>snl",
|
||||
function()
|
||||
require("noice").cmd("last")
|
||||
end,
|
||||
desc = "Noice Last Message",
|
||||
},
|
||||
{
|
||||
"<leader>snh",
|
||||
function()
|
||||
require("noice").cmd("history")
|
||||
end,
|
||||
desc = "Noice History",
|
||||
},
|
||||
{
|
||||
"<leader>sna",
|
||||
function()
|
||||
require("noice").cmd("all")
|
||||
end,
|
||||
desc = "Noice All",
|
||||
},
|
||||
{
|
||||
"<c-f>",
|
||||
function()
|
||||
if not require("noice.lsp").scroll(4) then
|
||||
return "<c-f>"
|
||||
end
|
||||
end,
|
||||
silent = true,
|
||||
expr = true,
|
||||
desc = "Scroll forward",
|
||||
mode = { "i", "n", "s" },
|
||||
},
|
||||
{
|
||||
"<c-b>",
|
||||
function()
|
||||
if not require("noice.lsp").scroll(-4) then
|
||||
return "<c-b>"
|
||||
end
|
||||
end,
|
||||
silent = true,
|
||||
expr = true,
|
||||
desc = "Scroll backward",
|
||||
mode = { "i", "n", "s" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"hrsh7th/cmp-cmdline",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local wilder = require("wilder")
|
||||
wilder.setup({ modes = { ":", "/", "?" } })
|
||||
wilder.set_option(
|
||||
"renderer",
|
||||
wilder.popupmenu_renderer({
|
||||
highlighter = wilder.basic_highlighter(),
|
||||
left = { " ", wilder.popupmenu_devicons() },
|
||||
right = { " ", wilder.popupmenu_scrollbar() },
|
||||
})
|
||||
)
|
||||
local cmp = require("cmp")
|
||||
local mapping = {
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
["<S-Tab>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
|
||||
["<Down>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
["<Tab>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
|
||||
}
|
||||
|
||||
-- Use buffer source for `/`.
|
||||
cmp.setup.cmdline("/", {
|
||||
preselect = "none",
|
||||
completion = {
|
||||
completeopt = "menu,preview,menuone,noselect",
|
||||
},
|
||||
mapping = mapping,
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
native_menu = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'.
|
||||
cmp.setup.cmdline(":", {
|
||||
preselect = "none",
|
||||
completion = {
|
||||
completeopt = "menu,preview,menuone,noselect",
|
||||
},
|
||||
mapping = mapping,
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
native_menu = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue