fix: ensure single quotes are used consistently across configuration files
This commit is contained in:
+69
-70
@@ -3,6 +3,7 @@
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ Auto Completion │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
local perf = vim.g.cmp_performance_enabled or false
|
||||
--- Function to return the cmp provider
|
||||
---@param performance? boolean Whether to use the experimental cmp performance fork
|
||||
@@ -11,42 +12,44 @@ local function cmp_provider(performance)
|
||||
if performance then
|
||||
return {
|
||||
-- Experiemental cmp performance fork
|
||||
url = "hrsh7th/nvim-cmp",
|
||||
url = 'hrsh7th/nvim-cmp',
|
||||
--url = "iguanacucumber/magazine.nvim",
|
||||
dev = true,
|
||||
}
|
||||
else
|
||||
return {
|
||||
-- Classic cmp
|
||||
url = "hrsh7th/nvim-cmp",
|
||||
url = 'hrsh7th/nvim-cmp',
|
||||
dev = false,
|
||||
}
|
||||
end
|
||||
end
|
||||
local cmp_repo = cmp_provider(perf)
|
||||
|
||||
-- Else use classic cmp
|
||||
return { -- cmp
|
||||
url = cmp_repo.url,
|
||||
build = cmp_repo.build,
|
||||
branch = cmp_repo.branch,
|
||||
dev = cmp_repo.dev,
|
||||
event = "VeryLazy",
|
||||
dependencies = require("data.deps").cmp,
|
||||
event = 'VeryLazy',
|
||||
dependencies = require('data.deps').cmp,
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
cmp.event:on("menu_opened", function()
|
||||
if require("data.cond").neocodeium() == true then
|
||||
require("neocodeium").clear()
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
cmp.event:on('menu_opened', function()
|
||||
if require('data.cond').neocodeium() == true then
|
||||
require('neocodeium').clear()
|
||||
end
|
||||
end)
|
||||
cmp.event:on("menu_closed", function()
|
||||
if require("data.cond").neocodeium() == true then
|
||||
require("neocodeium.commands").enable()
|
||||
require("neocodeium").cycle_or_complete()
|
||||
cmp.event:on('menu_closed', function()
|
||||
if require('data.cond').neocodeium() == true then
|
||||
require('neocodeium.commands').enable()
|
||||
require('neocodeium').cycle_or_complete()
|
||||
end
|
||||
end)
|
||||
local border_opts = {
|
||||
border = vim.g.completion_borders or "rounded",
|
||||
border = vim.g.completion_borders or 'rounded',
|
||||
}
|
||||
local window_opts = {
|
||||
completion = cmp.config.window.bordered(border_opts),
|
||||
@@ -60,7 +63,7 @@ return { -- cmp
|
||||
and vim.api
|
||||
.nvim_buf_get_lines(0, line - 1, line, true)[1]
|
||||
:sub(col, col)
|
||||
:match("%s")
|
||||
:match('%s')
|
||||
== nil
|
||||
end
|
||||
cmp.setup({
|
||||
@@ -69,22 +72,22 @@ return { -- cmp
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = { completeopt = "menu,menuone,noinsert" },
|
||||
window = vim.g.completion_borders == "rounded" and window_opts or {},
|
||||
completion = { completeopt = 'menu,menuone,noinsert' },
|
||||
window = vim.g.completion_borders == 'rounded' and window_opts or {},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<Up>"] = cmp.mapping.select_prev_item({
|
||||
['<C-n>'] = cmp.mapping.select_next_item(),
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<Up>'] = cmp.mapping.select_prev_item({
|
||||
behavior = cmp.SelectBehavior.Select,
|
||||
}),
|
||||
["<Down>"] = cmp.mapping.select_next_item({
|
||||
['<Down>'] = cmp.mapping.select_next_item({
|
||||
behavior = cmp.SelectBehavior.Select,
|
||||
}),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<C-Space>"] = cmp.mapping.complete({}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-Space>'] = cmp.mapping.complete({}),
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_locally_jumpable() then
|
||||
@@ -98,8 +101,8 @@ return { -- cmp
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
@@ -111,42 +114,38 @@ return { -- cmp
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp", priority = 1000 },
|
||||
{ name = "luasnip", priority = 750 },
|
||||
{ name = "path", priority = 250 },
|
||||
{ name = "buffer", priority = 250 },
|
||||
{ name = "cmp_yanky" },
|
||||
{ name = "dotenv" },
|
||||
{ name = "calc" },
|
||||
{ name = "conventionalcommits" },
|
||||
-- { name = "nerd", priority = 9997 },
|
||||
-- { name = "gitmoji", priority = 9998 },
|
||||
-- { name = "emoji", priority = 9999 },
|
||||
-- { name = "math", priority = 9999 },
|
||||
{ name = 'nvim_lsp', priority = 1000 },
|
||||
{ name = 'luasnip', priority = 750 },
|
||||
{ name = 'path', priority = 250 },
|
||||
{ name = 'buffer', priority = 250 },
|
||||
{ name = 'cmp_yanky' },
|
||||
{ name = 'dotenv' },
|
||||
{ name = 'calc' },
|
||||
{ name = 'conventionalcommits' },
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
fields = { 'abbr', 'kind', 'menu' },
|
||||
expandable_indicator = true,
|
||||
format = function(entry, item)
|
||||
local custom_menu_icon = {
|
||||
calc = " Calculator",
|
||||
math = " Math",
|
||||
nerd = " Glyphs",
|
||||
gitmoji = " Gitmoji",
|
||||
emoji = " Emoji",
|
||||
conventionalcommits = " Commit Message",
|
||||
path = " Path",
|
||||
buffer = " Buffer",
|
||||
dotenv = " Dotenv",
|
||||
cmp_yanky = " History",
|
||||
calc = ' Calculator',
|
||||
math = ' Math',
|
||||
nerd = ' Glyphs',
|
||||
gitmoji = ' Gitmoji',
|
||||
emoji = ' Emoji',
|
||||
conventionalcommits = ' Commit Message',
|
||||
path = ' Path',
|
||||
buffer = ' Buffer',
|
||||
dotenv = ' Dotenv',
|
||||
cmp_yanky = ' History',
|
||||
}
|
||||
local color_item =
|
||||
require("nvim-highlight-colors").format(entry, { kind = item.kind })
|
||||
item = require("lspkind").cmp_format({
|
||||
require("tailwind-tools.cmp").lspkind_format,
|
||||
require('nvim-highlight-colors').format(entry, { kind = item.kind })
|
||||
item = require('lspkind').cmp_format({
|
||||
require('tailwind-tools.cmp').lspkind_format,
|
||||
})(entry, item)
|
||||
if color_item.abbr_hl_group then
|
||||
item.kind_hl_group = color_item.abbr_hl_group
|
||||
@@ -161,42 +160,42 @@ return { -- cmp
|
||||
},
|
||||
})
|
||||
-- `:` cmdline setup.
|
||||
cmp.setup.cmdline(":", {
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
{ name = 'path' },
|
||||
}, {
|
||||
{
|
||||
name = "cmdline",
|
||||
name = 'cmdline',
|
||||
option = {
|
||||
ignore_cmds = { "Man", "!" },
|
||||
ignore_cmds = { 'Man', '!' },
|
||||
},
|
||||
},
|
||||
}, { name = "cmp-cmdline-history" }, {
|
||||
name = "cmp-cmdline-prompt",
|
||||
}, { name = 'cmp-cmdline-history' }, {
|
||||
name = 'cmp-cmdline-prompt',
|
||||
}),
|
||||
})
|
||||
-- Additional setup for cmdline filetype
|
||||
cmp.setup.filetype("cmdline", {
|
||||
cmp.setup.filetype('cmdline', {
|
||||
sources = {
|
||||
{ name = "cmdline" }, -- Ensure 'cmdline' source is available
|
||||
{ name = "path" },
|
||||
{ name = "cmp-cmdline-history" },
|
||||
{ name = "cmp-cmdline-prompt" },
|
||||
{ name = 'cmdline' }, -- Ensure 'cmdline' source is available
|
||||
{ name = 'path' },
|
||||
{ name = 'cmp-cmdline-history' },
|
||||
{ name = 'cmp-cmdline-prompt' },
|
||||
},
|
||||
})
|
||||
-- Input filetype
|
||||
cmp.setup.filetype("input", {
|
||||
cmp.setup.filetype('input', {
|
||||
sources = {},
|
||||
})
|
||||
-- Custom filetype configuration
|
||||
cmp.setup.filetype("config", {
|
||||
cmp.setup.filetype('config', {
|
||||
sources = vim.tbl_filter(function(source)
|
||||
return source.name ~= "emoji" and source.name ~= "gitmoji"
|
||||
return source.name ~= 'emoji' and source.name ~= 'gitmoji'
|
||||
end, cmp.get_config().sources),
|
||||
})
|
||||
-- List of filetypes to disable completion
|
||||
local disabled_filetypes = require("data.types").cmp
|
||||
local disabled_filetypes = require('data.types').cmp
|
||||
for _, filetype in ipairs(disabled_filetypes) do
|
||||
cmp.setup.filetype(filetype, {
|
||||
sources = {},
|
||||
|
||||
Reference in New Issue
Block a user