diff --git a/lua/custom/plugins/cmdline.lua b/lua/custom/plugins/cmdline.lua index 7cd864a..353f09d 100644 --- a/lua/custom/plugins/cmdline.lua +++ b/lua/custom/plugins/cmdline.lua @@ -5,157 +5,157 @@ local use_noice = true -- is_neovide = true -- use_noice = false -- end -vim.opt.lazyredraw = is_neovide +-- vim.opt.lazyredraw = is_neovide return { - { "gelguy/wilder.nvim", enabled = not use_noice }, - { - "folke/noice.nvim", - lazy = true, - enabled = use_noice, - dependencies = { - { "MunifTanjim/nui.nvim", enabled = use_noice }, - }, - -- event = "BufWinEnter", - event = "VeryLazy", - opts = { - messages = { - enabled = false, - }, - notify = { - enabled = false, - }, - lsp = { - progress = { - enabled = false, - }, - hover = { - enabled = false, - }, - signature = { - enabled = false, - }, - }, - }, - init = function() - -- load if mode command mode - -- vim.api.nvim_create_autocmd("CmdlineEnter", { - -- callback = function() - -- require("lazy").load({ plugins = { "noice.nvim" } }) - -- end, - -- }) - -- require("lazy").load({ plugins = { "noice.nvim" } }) - end, - keys = { - { - "", - function() - require("noice").redirect(vim.fn.getcmdline()) - end, - mode = "c", - desc = "Redirect Cmdline", - }, - { - "snl", - function() - require("noice").cmd("last") - end, - desc = "Noice Last Message", - }, - { - "snh", - function() - require("noice").cmd("history") - end, - desc = "Noice History", - }, - { - "sna", - function() - require("noice").cmd("all") - end, - desc = "Noice All", - }, - { - "", - function() - if not require("noice.lsp").scroll(4) then - return "" - end - end, - silent = true, - expr = true, - desc = "Scroll forward", - mode = { "i", "n", "s" }, - }, - { - "", - function() - if not require("noice.lsp").scroll(-4) then - return "" - end - end, - silent = true, - expr = true, - desc = "Scroll backward", - mode = { "i", "n", "s" }, - }, - }, - }, - { - "hrsh7th/cmp-cmdline", - event = "VeryLazy", - enabled = use_noice, - init = function() - -- load if mode command mode - -- vim.api.nvim_create_autocmd("CmdlineEnter", { - -- callback = function() - -- require("lazy").load({ plugins = { "cmp-cmdline" } }) - -- end, - -- }) - end, - config = function() - local cmp = require("cmp") - local mapping = { - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), - [""] = 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, - }, + -- { "gelguy/wilder.nvim", enabled = not use_noice }, + -- { + -- "folke/noice.nvim", + -- lazy = true, + -- enabled = use_noice, + -- dependencies = { + -- { "MunifTanjim/nui.nvim", enabled = use_noice }, + -- }, + -- -- event = "BufWinEnter", + -- event = "VeryLazy", + -- opts = { + -- messages = { + -- enabled = false, + -- }, + -- notify = { + -- enabled = false, + -- }, + -- lsp = { + -- progress = { + -- enabled = false, + -- }, + -- hover = { + -- enabled = false, + -- }, + -- signature = { + -- enabled = false, + -- }, + -- }, + -- }, + -- init = function() + -- -- load if mode command mode + -- -- vim.api.nvim_create_autocmd("CmdlineEnter", { + -- -- callback = function() + -- -- require("lazy").load({ plugins = { "noice.nvim" } }) + -- -- end, + -- -- }) + -- -- require("lazy").load({ plugins = { "noice.nvim" } }) + -- end, + -- keys = { + -- { + -- "", + -- function() + -- require("noice").redirect(vim.fn.getcmdline()) + -- end, + -- mode = "c", + -- desc = "Redirect Cmdline", + -- }, + -- { + -- "snl", + -- function() + -- require("noice").cmd("last") + -- end, + -- desc = "Noice Last Message", + -- }, + -- { + -- "snh", + -- function() + -- require("noice").cmd("history") + -- end, + -- desc = "Noice History", + -- }, + -- { + -- "sna", + -- function() + -- require("noice").cmd("all") + -- end, + -- desc = "Noice All", + -- }, + -- { + -- "", + -- function() + -- if not require("noice.lsp").scroll(4) then + -- return "" + -- end + -- end, + -- silent = true, + -- expr = true, + -- desc = "Scroll forward", + -- mode = { "i", "n", "s" }, + -- }, + -- { + -- "", + -- function() + -- if not require("noice.lsp").scroll(-4) then + -- return "" + -- end + -- end, + -- silent = true, + -- expr = true, + -- desc = "Scroll backward", + -- mode = { "i", "n", "s" }, + -- }, + -- }, + -- }, + -- { + -- "hrsh7th/cmp-cmdline", + -- event = "VeryLazy", + -- enabled = use_noice, + -- init = function() + -- -- load if mode command mode + -- -- vim.api.nvim_create_autocmd("CmdlineEnter", { + -- -- callback = function() + -- -- require("lazy").load({ plugins = { "cmp-cmdline" } }) + -- -- end, + -- -- }) + -- end, + -- config = function() + -- local cmp = require("cmp") + -- local mapping = { + -- [""] = cmp.mapping.confirm({ select = true }), + -- [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), + -- [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), + -- [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), + -- [""] = 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, + -- }, } diff --git a/lua/plugins/cmp_cmdline.lua b/lua/plugins/cmp_cmdline.lua index 19948ab..7e3a529 100644 --- a/lua/plugins/cmp_cmdline.lua +++ b/lua/plugins/cmp_cmdline.lua @@ -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 = { + { + "", + function() + require("noice").redirect(vim.fn.getcmdline()) + end, + mode = "c", + desc = "Redirect Cmdline", + }, + { + "snl", + function() + require("noice").cmd("last") + end, + desc = "Noice Last Message", + }, + { + "snh", + function() + require("noice").cmd("history") + end, + desc = "Noice History", + }, + { + "sna", + function() + require("noice").cmd("all") + end, + desc = "Noice All", + }, + { + "", + function() + if not require("noice.lsp").scroll(4) then + return "" + end + end, + silent = true, + expr = true, + desc = "Scroll forward", + mode = { "i", "n", "s" }, + }, + { + "", + function() + if not require("noice.lsp").scroll(-4) then + return "" + 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 = { + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), + [""] = 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, }, }