Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions lua/cmp_cmdline/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,18 @@ local definitions = {
--- create items.
local items = {}
local escaped = cmdline:gsub([[\\]], [[\\\\]]);
for _, word_or_item in ipairs(vim.fn.getcompletion(escaped, 'cmdline')) do
local word = type(word_or_item) == 'string' and word_or_item or word_or_item.word
local item = { label = word }
table.insert(items, item)
if is_option_name_completion and is_boolean_option(word) then
table.insert(items, vim.tbl_deep_extend('force', {}, item, {
label = 'no' .. word,
filterText = word,
}))
local ok, completions = pcall(vim.fn.getcompletion, escaped, 'cmdline')
if ok then
for _, word_or_item in ipairs(completions) do
local word = type(word_or_item) == 'string' and word_or_item or word_or_item.word
local item = { label = word }
table.insert(items, item)
if is_option_name_completion and is_boolean_option(word) then
table.insert(items, vim.tbl_deep_extend('force', {}, item, {
label = 'no' .. word,
filterText = word,
}))
end
end
end

Expand Down