cmp: path now uses async_path plugin source

This commit is contained in:
Tigor Hutasuhut 2024-08-01 18:21:54 +07:00
parent c1e0841a85
commit bdbf733def
2 changed files with 62 additions and 53 deletions

View file

@ -7,6 +7,7 @@
"before.nvim": { "branch": "master", "commit": "42294a3ba5dc02d3f3a9fe4e9a033ef29da6dcc6" }, "before.nvim": { "branch": "master", "commit": "42294a3ba5dc02d3f3a9fe4e9a033ef29da6dcc6" },
"bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" }, "bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" },
"catppuccin": { "branch": "main", "commit": "10eda02ea4faa7d1f94e77a3410a4ae91c25c5f5" }, "catppuccin": { "branch": "main", "commit": "10eda02ea4faa7d1f94e77a3410a4ae91c25c5f5" },
"cmp-async-path": { "branch": "main", "commit": "7df7f3721c45aac26b6e0474087538f4681c9c7a" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
@ -67,13 +68,13 @@
"nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" },
"nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" }, "nvim-ts-autotag": { "branch": "main", "commit": "dc5e1687ab76ee02e0f11c5ce137f530b36e98b3" },
"obsidian.nvim": { "branch": "main", "commit": "b92e75b7e711161467ca4805260b787e652358bf" }, "obsidian.nvim": { "branch": "main", "commit": "7466e3f70ffde1d3d8daf2d724da4ea9b4fa3642" },
"one-small-step-for-vimkind": { "branch": "main", "commit": "730189c92c6fd80eb92bb6c1886392a142dba273" }, "one-small-step-for-vimkind": { "branch": "main", "commit": "730189c92c6fd80eb92bb6c1886392a142dba273" },
"persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" },
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" }, "project.nvim": { "branch": "main", "commit": "8c6bad7d22eef1b71144b401c9f74ed01526a4fb" },
"render-markdown": { "branch": "main", "commit": "ef0c921858cbe079d40304200af60b6ce0c99429" }, "render-markdown": { "branch": "main", "commit": "4d046cdf65393a62c0eb209e01574b39f28bc01b" },
"rose-pine": { "branch": "main", "commit": "e4b08d74b7272cb21e4e9c71b8b9e0830fd722fe" }, "rose-pine": { "branch": "main", "commit": "e4b08d74b7272cb21e4e9c71b8b9e0830fd722fe" },
"rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" }, "rustaceanvim": { "branch": "master", "commit": "047f9c9d8cd2861745eb9de6c1570ee0875aa795" },
"silicon.lua": { "branch": "main", "commit": "f1387c8e2e69743899d6da6d4bd0e42be5ac5fa0" }, "silicon.lua": { "branch": "main", "commit": "f1387c8e2e69743899d6da6d4bd0e42be5ac5fa0" },

View file

@ -1,62 +1,70 @@
return { return {
"hrsh7th/nvim-cmp", {
dependencies = { "hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline", enabled = false,
"hrsh7th/cmp-nvim-lsp-document-symbol",
-- "hrsh7th/cmp-nvim-lsp-signature-help",
{ "lukas-reineke/cmp-rg", enabled = vim.fn.exepath "rg" ~= "" },
}, },
event = { "InsertEnter", "CmdlineEnter" }, {
opts = function(_, opts) "hrsh7th/nvim-cmp",
local cmp = require "cmp" dependencies = {
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lsp-document-symbol",
"https://codeberg.org/FelipeLema/cmp-async-path.git",
-- "hrsh7th/cmp-nvim-lsp-signature-help",
{ "lukas-reineke/cmp-rg", enabled = vim.fn.exepath "rg" ~= "" },
},
event = { "InsertEnter", "CmdlineEnter" },
opts = function(_, opts)
local cmp = require "cmp"
table.insert(opts.sources, 3, { name = "async_path" })
if vim.fn.exepath "rg" ~= "" then if vim.fn.exepath "rg" ~= "" then
table.insert(opts.sources, 3, { name = "rg" }) table.insert(opts.sources, 4, { name = "rg" })
end end
opts.preselect = cmp.PreselectMode.None opts.preselect = cmp.PreselectMode.None
opts.mapping = cmp.mapping.preset.insert { opts.mapping = cmp.mapping.preset.insert {
["<cr>"] = function(fallback) ["<cr>"] = function(fallback)
cmp.abort() cmp.abort()
fallback() fallback()
end, end,
["<c-cr>"] = cmp.mapping.confirm { select = true }, ["<c-cr>"] = cmp.mapping.confirm { select = true },
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }, ["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }, ["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
["<S-CR>"] = cmp.mapping.confirm { ["<S-CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
} }
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
cmp.setup.cmdline(":", { cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources { sources = cmp.config.sources {
{ name = "path" }, { name = "async_path" },
{ {
name = "cmdline", name = "cmdline",
option = { option = {
ignore_cmds = { "Man", "!" }, ignore_cmds = { "Man", "!" },
},
}, },
}, },
}, })
})
---@diagnostic disable-next-line: missing-fields ---@diagnostic disable-next-line: missing-fields
cmp.setup.cmdline("/", { cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources { sources = cmp.config.sources {
{ name = "nvim_lsp_document_symbol" }, { name = "nvim_lsp_document_symbol" },
{ name = "buffer" }, { name = "buffer" },
}, },
}) })
return opts return opts
end, end,
},
} }