i preferred this
This commit is contained in:
parent
d1a7fafe3a
commit
939e8a45f5
1 changed files with 0 additions and 28 deletions
|
|
@ -6,9 +6,6 @@
|
|||
|
||||
# Options provided to the require('cmp').setup function.
|
||||
settings = {
|
||||
# Disable autocompletion by default
|
||||
completion.autocomplete = false;
|
||||
|
||||
# The sources to use
|
||||
sources = [
|
||||
# Language Server Protocol
|
||||
|
|
@ -32,31 +29,6 @@
|
|||
|
||||
# Key mappings for the completion menu.
|
||||
mapping = {
|
||||
# Confirm candidate on TAB immediately when there's only one completion entry
|
||||
"<Tab>" = /* lua */ ''
|
||||
cmp.mapping(function(fallback)
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
|
||||
-- When the selection menu is open select the next item
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item({behavior = cmp.SelectBehavior.Select})
|
||||
-- Ensure we are mid word
|
||||
elseif col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil then
|
||||
-- Open the selection menu
|
||||
cmp.complete()
|
||||
-- Autocomplete when there is only 1 selection available
|
||||
if #cmp.get_entries() == 1 then
|
||||
cmp.confirm({ select = true })
|
||||
end
|
||||
-- Select the firt item
|
||||
cmp.select_next_item({behavior = cmp.SelectBehavior.Select})
|
||||
-- Keep regular functionality of tab
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {'i', 's'})
|
||||
'';
|
||||
|
||||
# Confirm selection
|
||||
"<CR>" = /* lua */ ''
|
||||
cmp.mapping.confirm({ select = true })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue