<commit_before>local load_module = require('utils.helpers').load_module

local plugins = require('neovim').plugins

-- local set_autocmd = require('neovim.autocmds').set_autocmd
-- local set_command = require'neovim.commands'.set_command
-- local set_mapping = require'neovim.mappings'.set_mapping

local cmp = load_module 'cmp'
if not cmp then
    return false
end

-- local lsp = require 'plugins.lsp'
-- local treesitter = require 'plugins.treesitter'

local vsnip = load_module 'vsnip'
local luasnip = load_module 'luasnip'
local ultisnips = plugins.ultisnips
local lspkind = require 'lspkind'

local sources = {
    { name = 'nvim_lsp' },
    { name = 'nvim_lua' },
}

if ultisnips then
    table.insert(sources, { name = 'ultisnips' })
elseif vsnip then
    table.insert(sources, { name = 'vsnip' })
elseif luasnip then
    table.insert(sources, { name = 'luasnip', opts = { use_show_condition = false } })
end

vim.list_extend(sources, { { name = 'buffer' }, { name = 'path' } })

local has_words_before = function()
    local line, col = unpack(vim.api.nvim_win_get_cursor(0))
    return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
end

-- local t = function(str)
--     return vim.api.nvim_replace_termcodes(str, true, true, true)
-- end

local next_item = function(fallback)
    if cmp.visible() then
        cmp.select_next_item()
    elseif luasnip and luasnip.jumpable(1) then
        luasnip.jump(1)
    elseif ultisnips and vim.fn['UltiSnips#CanJumpForwards']() == 1 then
        vim.fn['UltiSnips#JumpForwards']()
        -- vim.api.nvim_feedkeys(t '<Plug>(ultisnips_jump_forward)', 'm', true)
    elseif has_words_before() then
        cmp.complete()
    else
        -- The fallback function is treated as original mapped key. In this case, it might be `<Tab>`.<commit_msg>fix: cmp configs<commit_after>local load_module = require('utils.helpers').load_module

local plugins = require('neovim').plugins

-- local set_autocmd = require('neovim.autocmds').set_autocmd
-- local set_command = require'neovim.commands'.set_command
-- local set_mapping = require'neovim.mappings'.set_mapping

local cmp = load_module 'cmp'
if not cmp then
    return false
end

-- local lsp = require 'plugins.lsp'
-- local treesitter = require 'plugins.treesitter'

local vsnip = load_module 'vsnip'
local luasnip = load_module 'luasnip'
local ultisnips = plugins.ultisnips
local lspkind = require 'lspkind'

local sources = {
    { name = 'nvim_lsp' },
    { name = 'nvim_lua' },
}

if ultisnips then
    table.insert(sources, { name = 'ultisnips' })
elseif vsnip then
    table.insert(sources, { name = 'vsnip' })
elseif luasnip then
    table.insert(sources, { name = 'luasnip', option = { use_show_condition = false } })
end

vim.list_extend(sources, { { name = 'buffer' }, { name = 'path' } })

local has_words_before = function()
    local line, col = unpack(vim.api.nvim_win_get_cursor(0))
    return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
end

-- local t = function(str)
--     return vim.api.nvim_replace_termcodes(str, true, true, true)
-- end

local next_item = function(fallback)
    if cmp.visible() then
        cmp.select_next_item()
    elseif luasnip and luasnip.jumpable(1) then
        luasnip.jump(1)
    elseif ultisnips and vim.fn['UltiSnips#CanJumpForwards']() == 1 then
        vim.fn['UltiSnips#JumpForwards']()
        -- vim.api.nvim_feedkeys(t '<Plug>(ultisnips_jump_forward)', 'm', true)
    elseif has_words_before() then
        cmp.complete()
    else
        -- The fallback function is treated as original mapped key. In this case, it might be `<Tab>`.
{'fraction_non_alphanumeric': 0.1305758313057583, 'fraction_numerical': 0.004325493376588267, 'mean_word_length': 3.7989623865110245, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1974190', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1307, 'n_words': 313}