nvim: cmp now completes in the cmdline
This commit is contained in:
parent
89ef1fc30a
commit
1479f48e25
2 changed files with 25 additions and 1 deletions
|
@ -144,11 +144,26 @@ M.cmp = function()
|
|||
{ name = 'path' },
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'treesitter' },
|
||||
{ name = 'calc' },
|
||||
{ name = 'spell' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'cmdline' },
|
||||
{ name = 'emoji' },
|
||||
},
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
}),
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
},
|
||||
{
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
}),
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
-- fancy icons and a name of kind
|
||||
|
@ -158,8 +173,10 @@ M.cmp = function()
|
|||
path = "[Path]",
|
||||
nvim_lua = "[Lua]",
|
||||
nvim_lsp = "[LSP]",
|
||||
treesitter = "[TS]",
|
||||
calc = "[Calc]",
|
||||
spell = "[Spell]",
|
||||
cmdline = "[cmdline]",
|
||||
buffer = "[Buffer]",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
|
@ -203,6 +220,11 @@ M.lspconfig = function()
|
|||
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end -- <<<
|
||||
local capabilities
|
||||
if cmp ~= nil then -- only load this if cmp is loaded
|
||||
capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
end
|
||||
|
||||
-- Load servers >>>
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
|
|
|
@ -49,7 +49,7 @@ return require('packer').startup({function()
|
|||
}
|
||||
use { -- Default LSP configs
|
||||
'neovim/nvim-lspconfig',
|
||||
after = 'nvim-lspinstall',
|
||||
after = {'nvim-lspinstall',},
|
||||
config = function()
|
||||
require('blake.lsp').lspconfig()
|
||||
end
|
||||
|
@ -63,9 +63,11 @@ return require('packer').startup({function()
|
|||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-nvim-lua',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'ray-x/cmp-treesitter',
|
||||
'hrsh7th/cmp-calc',
|
||||
'f3fora/cmp-spell',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/cmp-emoji',
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue