all repos

init.lua @ cf87699fff6f73791ebcfd1aa54ccac9b5f70467

my nvim config
3 files changed, 28 insertions(+), 14 deletions(-)
refactor(cmp): change the way i setup sources
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2025-02-11 21:28:18 +0200
Parent: b879738
M lua/plugins/completion.lua

@@ -10,13 +10,8 @@ "hrsh7th/cmp-nvim-lsp",

{ "hrsh7th/cmp-cmdline", keys = { ":" } }, { "kirasok/cmp-hledger", ft = "ledger" }, }, - config = function() + config = function(_, opts) local cmp = require "cmp" - - cmp.event:on( - "confirm_done", - require("nvim-autopairs.completion.cmp").on_confirm_done() - ) ---@diagnostic disable-next-line: missing-fields cmp.setup.filetype({ "gitcommit", "NeogitCommitMessage" }, {

@@ -29,7 +24,15 @@ mapping = cmp.mapping.preset.cmdline(),

sources = { { name = "path" }, { name = "cmdline" } }, }) - cmp.setup { + cmp.setup(opts) + end, + + opts = function() + local cmp = require "cmp" + + ---@type cmp.Config + ---@diagnostic disable-next-line: missing-fields + return { snippet = { expand = function(args) require("luasnip").lsp_expand(args.body)

@@ -97,10 +100,7 @@ end

end, }, sources = cmp.config.sources { - { name = "orgmode", group_index = 0, max_item_count = 3 }, { name = "hledger", group_index = 0 }, - { name = "copilot", group_index = 2, max_item_count = 3 }, - { name = "lazydev", group_index = 0 }, { name = "nvim_lsp", max_item_count = 12 }, { name = "buffer", max_item_count = 4 }, { name = "luasnip", max_item_count = 3 },
M lua/plugins/core.lua

@@ -39,10 +39,18 @@ },

{ "windwp/nvim-autopairs", event = "InsertEnter", - opts = { - check_ts = true, - disable_filetype = { "TelescopePrompt", "markdown" }, - }, + dependencies = { "nvim-cmp" }, + config = function() + require("nvim-autopairs").setup { + check_ts = true, + disable_filetype = { "TelescopePrompt", "markdown" }, + } + + require("cmp").event:on( + "confirm_done", + require("nvim-autopairs.completion.cmp").on_confirm_done() + ) + end, }, { "3rd/image.nvim",
M lua/plugins/orgmode.lua

@@ -38,6 +38,12 @@ { "<leader>oa", action "agenda.prompt" },

}, dependencies = { { "akinsho/org-bullets.nvim", config = true }, + { + "nvim-cmp", + opts = function(_, opts) + table.insert(opts.sources, 1, { name = "orgmode" }) + end, + }, }, ---@module "orgmode" ---@type OrgConfigOpts