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 = 'path' },
|
||||||
{ name = 'nvim_lua' },
|
{ name = 'nvim_lua' },
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'treesitter' },
|
||||||
{ name = 'calc' },
|
{ name = 'calc' },
|
||||||
{ name = 'spell' },
|
{ name = 'spell' },
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
|
{ name = 'cmdline' },
|
||||||
{ name = 'emoji' },
|
{ name = 'emoji' },
|
||||||
},
|
},
|
||||||
|
cmp.setup.cmdline('/', {
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
}),
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(entry, vim_item)
|
format = function(entry, vim_item)
|
||||||
-- fancy icons and a name of kind
|
-- fancy icons and a name of kind
|
||||||
|
@ -158,8 +173,10 @@ M.cmp = function()
|
||||||
path = "[Path]",
|
path = "[Path]",
|
||||||
nvim_lua = "[Lua]",
|
nvim_lua = "[Lua]",
|
||||||
nvim_lsp = "[LSP]",
|
nvim_lsp = "[LSP]",
|
||||||
|
treesitter = "[TS]",
|
||||||
calc = "[Calc]",
|
calc = "[Calc]",
|
||||||
spell = "[Spell]",
|
spell = "[Spell]",
|
||||||
|
cmdline = "[cmdline]",
|
||||||
buffer = "[Buffer]",
|
buffer = "[Buffer]",
|
||||||
})[entry.source.name]
|
})[entry.source.name]
|
||||||
return vim_item
|
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>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||||
buf_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
buf_set_keymap('n', '<leader>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||||
end -- <<<
|
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 >>>
|
-- Load servers >>>
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
-- map buffer local keybindings when the language server attaches
|
-- map buffer local keybindings when the language server attaches
|
||||||
|
|
|
@ -49,7 +49,7 @@ return require('packer').startup({function()
|
||||||
}
|
}
|
||||||
use { -- Default LSP configs
|
use { -- Default LSP configs
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
after = 'nvim-lspinstall',
|
after = {'nvim-lspinstall',},
|
||||||
config = function()
|
config = function()
|
||||||
require('blake.lsp').lspconfig()
|
require('blake.lsp').lspconfig()
|
||||||
end
|
end
|
||||||
|
@ -63,9 +63,11 @@ return require('packer').startup({function()
|
||||||
'hrsh7th/cmp-path',
|
'hrsh7th/cmp-path',
|
||||||
'hrsh7th/cmp-nvim-lua',
|
'hrsh7th/cmp-nvim-lua',
|
||||||
'hrsh7th/cmp-nvim-lsp',
|
'hrsh7th/cmp-nvim-lsp',
|
||||||
|
'ray-x/cmp-treesitter',
|
||||||
'hrsh7th/cmp-calc',
|
'hrsh7th/cmp-calc',
|
||||||
'f3fora/cmp-spell',
|
'f3fora/cmp-spell',
|
||||||
'hrsh7th/cmp-buffer',
|
'hrsh7th/cmp-buffer',
|
||||||
|
'hrsh7th/cmp-cmdline',
|
||||||
'hrsh7th/cmp-emoji',
|
'hrsh7th/cmp-emoji',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue