cmp and autopairs

This commit is contained in:
2026-05-29 14:52:27 +02:00
parent 67f0d9f78c
commit 5eb695beaa
7 changed files with 123 additions and 125 deletions
+58 -58
View File
@@ -27,82 +27,82 @@ local function pick(light, dark)
end end
local c = { local c = {
bg = "#161219", bg = "#15130F",
bg_alt = "#1E1A21", bg_alt = "#1D1B17",
bg_float = "#221E25", bg_float = "#221F1A",
bg_popup = "#2D2830", bg_popup = "#2C2A25",
bg_cursorline = pick("#2D2830", "#38333B"), bg_cursorline = pick("#2C2A25", "#37342F"),
bg_fold = "#1E1A21", bg_fold = "#1D1B17",
bg_visual = "#543D68", bg_visual = "#51482F",
bg_search = pick("#B2417A", "#543D68"), bg_search = pick("#35491F", "#51482F"),
bg_incsearch = "#894FBF", bg_incsearch = "#514209",
bg_selection = "#894FBF", bg_selection = "#514209",
bg_statusline = pick("#2D2830", "#221E25"), bg_statusline = pick("#2C2A25", "#221F1A"),
bg_statusline_nc = "#1E1A21", bg_statusline_nc = "#1D1B17",
bg_tabline = "#1E1A21", bg_tabline = "#1D1B17",
bg_tabsel = "#2D2830", bg_tabsel = "#2C2A25",
fg = "#E9E0EA", fg = "#E8E2DA",
fg_muted = "#CEC3D3", fg_muted = "#CEC6B5",
fg_subtle = "#978D9D", fg_subtle = "#979081",
fg_comment = pick("#978D9D", "#4C4451"), fg_comment = pick("#979081", "#4B463A"),
fg_strong = pick("#1A1B1F", "#F2F2F7"), fg_strong = pick("#1A1B1F", "#F2F2F7"),
fg_on_soft = pick("#17181C", "#F4F4F8"), fg_on_soft = pick("#17181C", "#F4F4F8"),
border = "#4C4451", border = "#4B463A",
accent = "#DEB7FF", accent = "#DCC580",
accent_container = "#894FBF", accent_container = "#514209",
accent_fg = "#F7E7FF", accent_fg = "#C5AF6D",
accent_solid_fg = "#4A007F", accent_solid_fg = "#3C2F00",
secondary = "#D8BCEF", secondary = "#D2C6A5",
secondary_container = "#543D68", secondary_container = "#51482F",
secondary_fg = "#C6AADD", secondary_fg = "#C4B897",
secondary_solid_fg = "#3C2750", secondary_solid_fg = "#373019",
tertiary = "#FFB0D0", tertiary = "#B6CF98",
tertiary_container = "#B2417A", tertiary_container = "#35491F",
tertiary_fg = "#FFE7EE", tertiary_fg = "#A0B883",
tertiary_solid_fg = "#63003C", tertiary_solid_fg = "#23360E",
error = "#FFB4AB", error = "#FFB4AB",
error_container = "#93000A", error_container = "#93000A",
error_fg = "#FFDAD6", error_fg = "#FFDAD6",
error_solid_fg = "#690005", error_solid_fg = "#690005",
ok = "#FFBAC2", ok = "#E8CB46",
warn = "#FFDCF2", warn = "#FFE39D",
info = "#A9A5D8", info = "#AAAF6E",
hint = "#9DCEFF", hint = "#D6CC72",
add = "#FFBAC2", add = "#E8CB46",
change = "#A9A5D8", change = "#AAAF6E",
delete = "#DE4FFD", delete = "#BE8700",
cursor_fg = "#4A007F", cursor_fg = "#3C2F00",
cursor_bg = "#DEB7FF", cursor_bg = "#DCC580",
match_bg = "#B2417A", match_bg = "#35491F",
match_fg = "#FFE7EE", match_fg = "#A0B883",
todo_bg = "#B2417A", todo_bg = "#35491F",
todo_fg = "#FFE7EE", todo_fg = "#A0B883",
-- Syntax accents must stay dynamic. These come from your generated palette -- Syntax accents must stay dynamic. These come from your generated palette
-- instead of fixed hex values, so foregrounds change with the wallpaper too. -- instead of fixed hex values, so foregrounds change with the wallpaper too.
code_keyword = "#CA98DE", code_keyword = "#DB9F46",
code_func = "#9DCEFF", code_func = "#D6CC72",
code_string = "#FFBAC2", code_string = "#E8CB46",
code_number = "#FFDCF2", code_number = "#FFE39D",
code_const = "#DE4FFD", code_const = "#BE8700",
code_type = "#DEB7FF", code_type = "#DCC580",
code_special = "#FFB0D0", code_special = "#B6CF98",
code_preproc = "#D8BCEF", code_preproc = "#D2C6A5",
code_builtin = "#DEB7FF", code_builtin = "#DCC580",
code_param = "#FFDCF2", code_param = "#FFE39D",
code_field = "#D8BCEF", code_field = "#D2C6A5",
code_namespace = "#FFB0D0", code_namespace = "#B6CF98",
code_operator = pick("#DEB7FF", "#D8BCEF"), code_operator = pick("#DCC580", "#D2C6A5"),
line_current = pick("#232428", "#E7E7EC"), line_current = pick("#232428", "#E7E7EC"),
ref_bg = pick("#38333B", "#2D2830"), ref_bg = pick("#37342F", "#2C2A25"),
} }
-- Core UI ------------------------------------------------------------------- -- Core UI -------------------------------------------------------------------
+25 -2
View File
@@ -1,3 +1,26 @@
local npairs = require('nvim-autopairs') local M = {}
npairs.setup({}) M = {
disable_filetype = {
"TelescopePrompt",
"spectre_panel",
"snacks_picker_input",
},
disable_in_macro = true,
disable_in_visualblock = false,
disable_in_replace_mode = true,
ignored_next_char = [=[[%w%%%'%[%"%.%`%$]]=],
enable_moveright = true,
enable_afterquote = true,
enable_check_bracket_line = true,
enable_bracket_in_quote = true,
enable_abbr = false,
break_undo = true,
check_ts = false,
map_cr = true,
map_bs = true,
map_c_h = false,
map_c_w = false,
}
return M
-40
View File
@@ -1,40 +0,0 @@
local cmp_kinds = {
Text = '',
Method = '',
Function = '',
Constructor = '',
Field = '',
Variable = '',
Class = '',
Interface = '',
Module = '',
Property = '',
Unit = '',
Value = '',
Enum = '',
Keyword = '',
Snippet = '',
Color = '',
File = '',
Reference = '',
Folder = '',
EnumMember = '',
Constant = '',
Struct = '',
Event = '',
Operator = '',
TypeParameter = '',
}
local cmp = require('cmp')
cmp.setup({
preselect = 'None',
formatting = {
fields = { 'kind', 'abbr' },
format = function(_, vim_item)
vim_item.kind = cmp_kinds[vim_item.kind] or ''
return vim_item
end,
}
})
+18 -3
View File
@@ -1,6 +1,7 @@
local cmp = require "cmp" local cmp = require "cmp"
local cmp_lsp = require "cmp_nvim_lsp" local cmp_lsp = require "cmp_nvim_lsp"
local cmp_kinds = require("assets.icons").icons.kinds local cmp_kinds = require("assets.icons").icons.kinds
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
local function flatten_to_array(t) local function flatten_to_array(t)
local res = {} local res = {}
@@ -133,9 +134,22 @@ cmp.setup {
["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(), ["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm { ["<CR>"] = cmp.mapping {
behavior = cmp.ConfirmBehavior.Insert, i = function(fallback)
select = true, if cmp.visible() and cmp.get_active_entry() then
cmp.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
}
else
fallback()
end
end,
s = cmp.mapping.confirm { select = true },
c = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
}, },
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
@@ -165,6 +179,7 @@ cmp.setup {
{ name = "nvim_lua" }, { name = "nvim_lua" },
}, },
} }
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
vim.diagnostic.config { vim.diagnostic.config {
virtual_text = false, virtual_text = false,
+10 -10
View File
@@ -6,19 +6,19 @@ local function pick(light, dark)
end end
local c = { local c = {
bg = "#161219", bg = "#15130F",
bg_alt = "#1E1A21", bg_alt = "#1D1B17",
bg_mid = pick("#2D2830", "#221E25"), bg_mid = pick("#2C2A25", "#221F1A"),
fg = "#E9E0EA", fg = "#E8E2DA",
fg_muted = "#CEC3D3", fg_muted = "#CEC6B5",
fg_strong = pick("#15161A", "#F4F4F8"), fg_strong = pick("#15161A", "#F4F4F8"),
normal = "#894FBF", normal = "#514209",
insert = "#543D68", insert = "#51482F",
visual = "#B2417A", visual = "#35491F",
replace = "#93000A", replace = "#93000A",
command = pick("#FFDCF2", "#A9A5D8"), command = pick("#FFE39D", "#AAAF6E"),
inactive = "#1E1A21", inactive = "#1D1B17",
normal_fg = pick("#15161A", "#F4F4F8"), normal_fg = pick("#15161A", "#F4F4F8"),
insert_fg = pick("#15161A", "#F4F4F8"), insert_fg = pick("#15161A", "#F4F4F8"),
+4 -4
View File
@@ -19,10 +19,10 @@ vim.keymap.set("n", "<A-S-Left>", require("smart-splits").resize_left)
vim.keymap.set("n", "<A-S-Down>", require("smart-splits").resize_down) vim.keymap.set("n", "<A-S-Down>", require("smart-splits").resize_down)
vim.keymap.set("n", "<A-S-Up>", require("smart-splits").resize_up) vim.keymap.set("n", "<A-S-Up>", require("smart-splits").resize_up)
vim.keymap.set("n", "<A-S-Right>", require("smart-splits").resize_right) vim.keymap.set("n", "<A-S-Right>", require("smart-splits").resize_right)
vim.keymap.set("n", "<A-Left>", require("smart-splits").move_cursor_left) -- vim.keymap.set("n", "<A-Left>", require("smart-splits").move_cursor_left)
vim.keymap.set("n", "<A-Down>", require("smart-splits").move_cursor_down) -- vim.keymap.set("n", "<A-Down>", require("smart-splits").move_cursor_down)
vim.keymap.set("n", "<A-Up>", require("smart-splits").move_cursor_up) -- vim.keymap.set("n", "<A-Up>", require("smart-splits").move_cursor_up)
vim.keymap.set("n", "<A-Right>", require("smart-splits").move_cursor_right) -- vim.keymap.set("n", "<A-Right>", require("smart-splits").move_cursor_right)
-- Explorer and Undotree -- Explorer and Undotree
map("n", "<leader>e", function() map("n", "<leader>e", function()
+8 -8
View File
@@ -70,13 +70,6 @@ return {
"hiphish/rainbow-delimiters.nvim", "hiphish/rainbow-delimiters.nvim",
enabled = false, enabled = false,
}, },
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require "config.autopairs"
end,
},
{ {
"tpope/vim-fugitive", "tpope/vim-fugitive",
}, },
@@ -116,6 +109,13 @@ return {
require "config.lazydev" require "config.lazydev"
end, end,
}, },
{
"windwp/nvim-autopairs",
enabled = true,
event = "InsertEnter",
config = true,
opts = require "config.autopairs",
},
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
enabled = true, enabled = true,
@@ -131,6 +131,7 @@ return {
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
"j-hui/fidget.nvim", "j-hui/fidget.nvim",
"b0o/schemastore.nvim", "b0o/schemastore.nvim",
"windwp/nvim-autopairs",
}, },
config = function() config = function()
require "config.lspconfig" require "config.lspconfig"
@@ -288,7 +289,6 @@ return {
}, },
{ {
"Zacharias-Brohn/zterm-navigator.nvim", "Zacharias-Brohn/zterm-navigator.nvim",
enabled = false,
config = function() config = function()
require "config.zterm-navigator" require "config.zterm-navigator"
end, end,