Completion Menu in Nvim with Rich Support
nvim-cmp は Nvim で使用される補完エンジンです。
このプラグインに様々な Sources(補完候補生成エンジン)を組み合わせることで最近の IDE にも負けない補完が可能です。
Vim / Neovim における補完エンジンは様々な派閥がありますが、現状 Nvim で最も使用されているものはこのプラグインだと思います。
Snippets
また、同時に Snippet エンジンも紹介します。 スニペットに関しては VsCode のスニペットのススメ これなんかを読んでみてください。
Nvim ではスニペットの補完と LSP などの補完、さらに英語単語帳を使った補完など色々組み合わせて最適な並び順で表示してくれるように設定が可能です。
Setup
70-cmp-config/init.lua
return {
setup = {
-- "smjonas/snippet-converter.nvim", -- Use to convert snippet files. See `nlua/lsp-config/snippet-converter.lua`
"windwp/nvim-autopairs",
{
"numToStr/Comment.nvim",
requires = "JoosepAlviste/nvim-ts-context-commentstring",
},
{
"L3MON4D3/LuaSnip",
requires = {
"rafamadriz/friendly-snippets",
{ "honza/vim-snippets", rtp = "." },
"molleweide/LuaSnip-snippets.nvim",
"gisphm/vim-gitignore",
},
},
{
"hrsh7th/nvim-cmp",
requires = {
"hrsh7th/cmp-buffer", -- buffer completions
"hrsh7th/cmp-path", -- path completions
"hrsh7th/cmp-cmdline", -- cmdline completions
"hrsh7th/cmp-nvim-lua", -- nvim lua config completion
"hrsh7th/cmp-calc",
"f3fora/cmp-spell",
"hrsh7th/cmp-cmdline",
"uga-rosa/cmp-dictionary",
"saadparwaiz1/cmp_luasnip",
"petertriho/cmp-git",
},
},
},
}Last updated on October 18, 2022