0

提示画像ですがnvim-cmp nvim-lspconfigを利用して自動補完を導入しているのですが例えばintと入力するとintに関するありとあらゆる情報が表示されるのですがこの表示を変更したいです。
VScodeのように組み込み型は表示されず既にある関数や変数のものだけ候補を表示してほしいのですがそうするにはどう設定すればいいのでしょうか?

試行錯誤した事

似たような自動補完プラグインをインストール
server_configurations.md設定方法を確認

参考サイト

nvim-lspconfig: https://github.com/neovim/nvim-lspconfig
nvim-cmp: https://github.com/hrsh7th/nvim-cmp/
server_configurations.md: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md

画像の説明をここに入力

init.lua

-------------- 自動補完 -------------- 
require('lspconfig').clangd.setup({})
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)

-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
  -- Enable completion triggered by <c-x><c-o>
  vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')

  -- Mappings.
  -- See `:help vim.lsp.*` for documentation on any of the below functions
  local bufopts = { noremap=true, silent=true, buffer=bufnr }
  vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
  vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
  vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
  vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
  vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
  vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
  vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
  vim.keymap.set('n', '<space>wl', function()
    print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
  end, bufopts)
  vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
  vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
  vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
  vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
  vim.keymap.set('n', '<space>f',function() vim.lsp.buf.format { async = true } end, bufopts)
end




  


require('cmp').setup({
  snippet = {
    -- REQUIRED - you must specify a snippet engine
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
      -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
      -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
      -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
    end,
  },
  window = {
    -- completion = require('cmp').config.window.bordered(),
    -- documentation = require('cmp').config.window.bordered(),
  },
  mapping = require('cmp').mapping.preset.insert({
    [>引用
init.lua

-------------- 自動補完 -------------- 
require('lspconfig').clangd.setup({})
local opts = { noremap=true, silent=true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)

-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
  -- Enable completion triggered by <c-x><c-o>
  vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')

  -- Mappings.
  -- See `:help vim.lsp.*` for documentation on any of the below functions
  local bufopts = { noremap=true, silent=true, buffer=bufnr }
  vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, '<C-b>'] = require('cmp').mapping.scroll_docs(-4),
    ['<C-f>'] = require('cmp').mapping.scroll_docs(4),
    ['<C-Space>'] = require('cmp').mapping.complete(),
    ['<C-e>'] = require('cmp').mapping.abort(),
    ['<CR>'] = require('cmp').mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
  }),
  sources = require('cmp').config.sources({
    { name = 'nvim_lsp' },
    { name = 'vsnip' }, -- For vsnip users.
    -- { name = 'luasnip' }, -- For luasnip users.
    -- { name = 'ultisnips' }, -- For ultisnips users.
    -- { name = 'snippy' }, -- For snippy users.
  }, {
    { name = 'buffer' },
  })
})

-- Set configuration for specific filetype.
require('cmp').setup.filetype('gitcommit', {
  sources = require('cmp').config.sources({
    { name = 'cmp_git' }, -- You can specify the `require('cmp')_git` source if you were installed it.
  }, {
    { name = 'buffer' },
  })
})

-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
require('cmp').setup.cmdline('/', {
  mapping = require('cmp').mapping.preset.cmdline(),
  sources = {
    { name = 'buffer' }
  }
})

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
require('cmp').setup.cmdline(':', {
  mapping = require('cmp').mapping.preset.cmdline(),
  sources = require('cmp').config.sources({
    { name = 'path' }
  }, {
    { name = 'cmdline' }
  })
})

Plugin.lua
vim.cmd[[packadd packer.nvim]]
require'packer'.startup(function()
  use 'wbthomason/packer.nvim'          -- パッケージマネージャー
  use 'Mofiqul/vscode.nvim'             -- テーマ
  use 'kyazdani42/nvim-web-devicons'    -- アイコン画像
  use 'Pocco81/auto-save.nvim'

  use 'nvim-treesitter/nvim-treesitter' -- シンタックスハイライト
  use 'nvim-lualine/lualine.nvim'       --  ステータスバー


  ---------------- 自動補完 ----------------
  use 'nvim-lua/completion-nvim'
  use 'neovim/nvim-lspconfig'


  use 'hrsh7th/cmp-nvim-lsp'
  use 'hrsh7th/cmp-buffer'
  use 'hrsh7th/cmp-path'
  use 'hrsh7th/cmp-cmdline'
  use 'hrsh7th/nvim-cmp'



  ---------------- ファイルツリー ----------------
  use 'kyazdani42/nvim-tree.lua'


end)

0

この質問に回答するには、ログインする必要があります。