🐛 Use lazy loading and fix completeopt in cmdline

This commit is contained in:
Ryan 2023-11-11 17:11:57 +08:00
parent 68f4a6595e
commit 49081f4dfb
Signed by: juan
GPG Key ID: 807ECD28A698D245
3 changed files with 27 additions and 14 deletions

View File

@ -11,7 +11,7 @@ o.showmode = false
o.scrolloff = 10 o.scrolloff = 10
-- controlling -- controlling
vim.opt.completeopt = { 'menu', 'menuone', 'noinsert' } vim.opt.completeopt = { 'menu', 'menuone', 'noselect' }
o.ignorecase = true o.ignorecase = true
o.smartcase = true o.smartcase = true
o.smartindent = true o.smartindent = true

View File

@ -49,6 +49,7 @@ local plugins = {
}, },
{ {
"nvim-treesitter/nvim-treesitter-context", "nvim-treesitter/nvim-treesitter-context",
event = {"BufReadPre", "BufNewFile"},
dependencies = { dependencies = {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
}, },
@ -93,8 +94,15 @@ local plugins = {
}, },
{ {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
},
lazy = true
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = {
{ {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
@ -102,18 +110,17 @@ local plugins = {
"williamboman/mason.nvim", "williamboman/mason.nvim",
} }
}, },
"null-ls.nvim"
}, },
config = function() config = function()
require("plugins.lsp") require("plugins.lsp")
end, end,
}
}, },
{ {
"jay-babu/mason-null-ls.nvim", "jay-babu/mason-null-ls.nvim",
config = function() config = function()
require("plugins.null-ls") require("plugins.null-ls")
end, end,
event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = {
"williamboman/mason.nvim", "williamboman/mason.nvim",
"jose-elias-alvarez/null-ls.nvim" "jose-elias-alvarez/null-ls.nvim"

View File

@ -67,9 +67,12 @@ cmp.setup({
cmp.setup.cmdline({ '/', '?' }, { cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
completion = {
completeopt = 'menu,menuone,noselect'
},
sources = { sources = {
{ name = 'buffer' } { name = 'buffer' }
} },
}) })
-- Set configuration for specific filetype. -- Set configuration for specific filetype.
@ -85,6 +88,9 @@ cmp.setup.filetype('gitcommit', {
-- `:` cmdline setup. -- `:` cmdline setup.
cmp.setup.cmdline(':', { cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
completion = {
completeopt = 'menu,menuone,noselect'
},
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'path' } { name = 'path' }
}, { }, {