wip: feat(nvim/rust-tools): begin migration
wip: feat(nvim/rust-tools): begin migration feat(nvim/dev-icons): enable feat(nvim/nerdtree): removed feat(nvim): removed coc feat(nvim/cmp): connect rust-tools feat(nvim/dap): setup lldb feat(nvim/cmp): icons feat(nvim/dap): icons feat(nvim/rust): load crates plugin feat(nvim): switch rust-tools to rustaceanvim feat(nvim): enable inlay hints feat(nvim): cmdline completions style: nix run sys#luaformatter -- home/nvim/*.lua -i feat(nvim/nix): break once neovim hits 0.10.0 wip: feat(nvim/rust-tools): begin migration feat(nvim): removed coc
This commit is contained in:
93
completion.lua
Normal file
93
completion.lua
Normal file
@@ -0,0 +1,93 @@
|
||||
<<<<<<< HEAD
|
||||
-- Set completeopt to have a better completion experience
|
||||
-- :help completeopt
|
||||
-- menuone: popup even when there's only one match
|
||||
-- noinsert: Do not insert text until a selection is made
|
||||
-- noselect: Do not select, force to select one from the menu
|
||||
-- shortness: avoid showing extra messages when using completion
|
||||
-- updatetime: set updatetime for CursorHold
|
||||
vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'}
|
||||
vim.opt.shortmess = vim.opt.shortmess + {c = true}
|
||||
vim.api.nvim_set_option('updatetime', 300)
|
||||
|
||||
-- Fixed column for diagnostics to appear
|
||||
-- Show autodiagnostic popup on cursor hover_range
|
||||
-- Goto previous / next diagnostic warning / error
|
||||
-- Show inlay_hints more frequently
|
||||
vim.cmd([[
|
||||
set signcolumn=yes
|
||||
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})
|
||||
-- Completion Plugin Setup
|
||||
local cmp = require 'cmp'
|
||||
cmp.setup({
|
||||
-- Enable LSP snippets
|
||||
snippet = {expand = function(args) vim.fn["vsnip#anonymous"](args.body) end},
|
||||
-- <C> = CTRL
|
||||
-- <S> = SHIFT
|
||||
mapping = {
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
-- Add tab support
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true
|
||||
})
|
||||
},
|
||||
-- Installed sources:
|
||||
sources = {
|
||||
{name = 'path'}, -- file paths
|
||||
{name = 'nvim_lsp', keyword_length = 3}, -- from language server
|
||||
{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 = 'calc'}, -- source for math calculation
|
||||
{
|
||||
name = 'spell',
|
||||
option = {
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function() return true end
|
||||
}
|
||||
}, {name = 'conventionalcommits', keyword_length = 1}, {name = 'crates'}
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered()
|
||||
},
|
||||
formatting = {
|
||||
fields = {'menu', 'abbr' --[[ 'kind' ]] },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
nvim_lsp = 'λ',
|
||||
vsnip = '⋗',
|
||||
buffer = '',
|
||||
path = '',
|
||||
spell = '¶',
|
||||
calc = '√',
|
||||
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(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({{name = 'path'}}, {
|
||||
{name = 'cmdline', option = {ignore_cmds = {'Man', '!'}}}
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user