feat(plugin): Add nvim-aputopairs, use symbols in cmp
This commit is contained in:
parent
e6c9d72c3f
commit
3777f30d68
3 changed files with 10 additions and 1 deletions
|
@ -35,6 +35,7 @@ with final.pkgs.lib; let
|
||||||
|
|
||||||
# nvim-cmp (autocompletion) and extensions
|
# nvim-cmp (autocompletion) and extensions
|
||||||
nvim-cmp # https://github.com/hrsh7th/nvim-cmp
|
nvim-cmp # https://github.com/hrsh7th/nvim-cmp
|
||||||
|
nvim-autopairs # Automatically create closing brackets | https://github.com/windwp/nvim-autopairs
|
||||||
cmp_luasnip # snippets autocompletion extension for nvim-cmp | https://github.com/saadparwaiz1/cmp_luasnip/
|
cmp_luasnip # snippets autocompletion extension for nvim-cmp | https://github.com/saadparwaiz1/cmp_luasnip/
|
||||||
lspkind-nvim # vscode-like LSP pictograms | https://github.com/onsails/lspkind.nvim/
|
lspkind-nvim # vscode-like LSP pictograms | https://github.com/onsails/lspkind.nvim/
|
||||||
cmp-nvim-lsp # LSP as completion source | https://github.com/hrsh7th/cmp-nvim-lsp/
|
cmp-nvim-lsp # LSP as completion source | https://github.com/hrsh7th/cmp-nvim-lsp/
|
||||||
|
|
|
@ -4,6 +4,7 @@ end
|
||||||
vim.g.did_load_completion_plugin = true
|
vim.g.did_load_completion_plugin = true
|
||||||
|
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
local lspkind = require('lspkind')
|
local lspkind = require('lspkind')
|
||||||
local luasnip = require('luasnip')
|
local luasnip = require('luasnip')
|
||||||
|
|
||||||
|
@ -31,10 +32,12 @@ cmp.setup {
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format {
|
format = lspkind.cmp_format {
|
||||||
mode = 'symbol_text',
|
-- mode = 'symbol_text',
|
||||||
|
mode = 'symbol',
|
||||||
with_text = true,
|
with_text = true,
|
||||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||||
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||||
|
-- show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||||
|
|
||||||
menu = {
|
menu = {
|
||||||
buffer = '[BUF]',
|
buffer = '[BUF]',
|
||||||
|
@ -52,6 +55,10 @@ cmp.setup {
|
||||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
-- cmp.event:on(
|
||||||
|
-- 'confirm_done',
|
||||||
|
-- cmp_autopairs.on_confirm_done()
|
||||||
|
-- ),
|
||||||
mapping = {
|
mapping = {
|
||||||
['<C-b>'] = cmp.mapping(function(_)
|
['<C-b>'] = cmp.mapping(function(_)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
|
|
|
@ -6,6 +6,7 @@ vim.g.did_load_plugins_plugin = true
|
||||||
-- many plugins annoyingly require a call to a 'setup' function to be loaded,
|
-- many plugins annoyingly require a call to a 'setup' function to be loaded,
|
||||||
-- even with default configs
|
-- even with default configs
|
||||||
|
|
||||||
|
require("nvim-autopairs").setup {}
|
||||||
require("dapui").setup()
|
require("dapui").setup()
|
||||||
-- require("copilot_cmp").setup()
|
-- require("copilot_cmp").setup()
|
||||||
require('nvim-surround').setup()
|
require('nvim-surround').setup()
|
||||||
|
|
Loading…
Reference in a new issue