feat(nvim): cmdline completions
This commit is contained in:
parent
1fafc88bc7
commit
ab37924276
@ -21,12 +21,8 @@ autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
||||
vim.opt.spell = true
|
||||
vim.opt.spelllang = {'en_us'}
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] =
|
||||
vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics,
|
||||
{
|
||||
virtual_text = true,
|
||||
}
|
||||
)
|
||||
vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics,
|
||||
{virtual_text = true})
|
||||
-- Completion Plugin Setup
|
||||
local cmp = require 'cmp'
|
||||
cmp.setup({
|
||||
@ -56,7 +52,6 @@ cmp.setup({
|
||||
{name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
|
||||
{name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
|
||||
{name = 'buffer', keyword_length = 2}, -- source current buffer
|
||||
{name = 'vsnip', keyword_length = 2}, -- nvim-cmp source for vim-vsnip
|
||||
{name = 'calc'}, -- source for math calculation
|
||||
{
|
||||
name = 'spell',
|
||||
@ -64,33 +59,34 @@ cmp.setup({
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function() return true end
|
||||
}
|
||||
},
|
||||
{name = 'conventionalcommits', keyword_length = 1 },
|
||||
{name = 'crates'},
|
||||
}, {name = 'conventionalcommits', keyword_length = 1}, {name = 'crates'}
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered()
|
||||
},
|
||||
formatting = {
|
||||
fields = {'menu', 'abbr', 'kind'},
|
||||
fields = {'menu', 'abbr' --[[ 'kind' ]] },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = 'λ',
|
||||
vsnip = '⋗',
|
||||
buffer = 'Ω',
|
||||
path = '📁',
|
||||
spell = '💬',
|
||||
buffer = '',
|
||||
path = '',
|
||||
spell = '¶',
|
||||
calc = '√',
|
||||
crates = '📦',
|
||||
crates = ''
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
if entry.source.name == "calc" then item.kind = "Math" end
|
||||
return item
|
||||
end
|
||||
}
|
||||
})
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' },
|
||||
}
|
||||
cmp.setup.cmdline('/', {sources = {{name = 'buffer'}}})
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({{name = 'path'}}, {
|
||||
{name = 'cmdline', option = {ignore_cmds = {'Man', '!'}}}
|
||||
})
|
||||
})
|
||||
|
@ -55,6 +55,7 @@ in
|
||||
cmp-spell
|
||||
cmp-conventionalcommits
|
||||
cmp-calc
|
||||
cmp-cmdline
|
||||
rustaceanvim
|
||||
lsp-inlayhints-nvim # https://github.com/mrcjkb/rustaceanvim/discussions/46#discussioncomment-7620822
|
||||
plenary-nvim
|
||||
|
Loading…
x
Reference in New Issue
Block a user