实际上,nvim-cmp不负责具体的补全操作,它的核心能力是根据各种源搜集供补全的文本片段,并提供了对这些片段的访问能力。而上述的一套插件,以'L3MON4D3/LuaSnip'配合'saadparwaiz1/cmp_luasnip'为例,LuaSnip是核心的代码补全操作引擎插件,他提供补全过程中UI操作等能力;而cmp_luasnip则是作为了nvim-cmp和LuaSni...
该字段主要用于配置补全的源,这里需要和前面的cmp补全源插件一一对应。例如,当配置了cmp-path的path源的时候,键入“/”就能看到候选的路径补全项: 190-nvim-cmp-source-path formatting字段: -- 使用lspkind-nvim显示类型图标 formatting = { format = lspkind.cmp_format({ with_text = true, -- do not ...
该字段主要用于配置补全的源,这里需要和前面的cmp补全源插件一一对应。例如,当配置了cmp-path的path源的时候,键入“/”就能看到候选的路径补全项: formatting字段: -- 使用lspkind-nvim显示类型图标formatting = {format= lspkind.cmp_format({ with_text =true,-- do not show text alongside iconsmaxwidth =5...
补全: nvim-cmp Snippets: nvim-snippy Markdown: plasticboy/vim-markdown 与markdown-preview 与headlines.nvim 与vim-MarkdownTOC 括号配对: nvim-surround 与nvim-autopairs 与nvim-ts-autotag 与vim-matchup Git: gitsigns 与lazygit 与diffview.nvim 缩进基准线: indent-blankline 光标移动: hop.nvim...
-- filename: nvimcmp.lualocalpresent,cmp=pcall(require,"cmp")ifnotpresentthenreturnendcmp.setup{snippet={expand=function(args)-- 使用 luasnip 片段引擎require("luasnip").lsp_expand(args.body)end},-- 设置如何显示项目类型和来源的名称formatting={format=function(entry,vim_item)-- fancy icons and...
2. `cmp.setup.cmdline` won't work if you use the `native` completion menu. 3. You can disable the `default` options by specifying `cmp.config.disable` value. >vim call plug#begin(s:plug_dir) Plug 'neovim/nvim-lspconfig' Plug 'hrsh7th/cmp-nvim-lsp' Plug 'hrsh7th/cmp-buffer' ...
cmp: boost copilot priority (6da4b80) config: disable ChatGPT by default (d58d5d2) dap: improve config (a97a93b) formatting: add conform.nvim & nvim-lint for linting & formatting (325074d) keymappings: add quickfix list keymap to q (610f504) keymappings: change save session ...
cmp.setup { formatting = { format = cmpFormat1 }, snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end }, mapping = { ["<C-p>"] = cmp.mapping.select_prev_item(), ["<C-n>"] = cmp.mapping.select_next_item(), ["<C-d>"] = cmp.mapping....
针对代码的补全我们可以基于 lsp的配置使用插件来完成,这里我推荐使用 nvim-cmp插件
cmp.setup { formatting = { format = cmpFormat1 }, snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end }, mapping = { ["<C-p>"] = cmp.mapping.select_prev_item(), ["<C-n>"] = cmp.mapping.select_next_item(), ["<C-d>"] = cmp.mapping....