all repos

init.lua @ ed0b5de39310d9abb9e7f813fa8c9c69be606724

my nvim config
5 files changed, 2 insertions(+), 127 deletions(-)
refactor(snippets): remove snippets from the config
Author: Smirnov Oleksandr ss2316544@gmail.com
Committed at: 2024-01-15 19:05:42 +0200
Parent: 70d749b
D

@@ -1,19 +0,0 @@

----@diagnostic disable: undefined-global --- selene: allow(undefined_variable) -return { - s({ trig = "td", name = "TODO" }, { - d(1, function() - local function with_cmt(cmt) - return string.format(vim.bo.commentstring, " " .. cmt) - end - return s("", { - c(1, { - t(with_cmt "TODO: "), - t(with_cmt "FIXME: "), - t(with_cmt "BUG: "), - }), - }) - end), - i(0), - }), -}
D

@@ -1,27 +0,0 @@

----@diagnostic disable: undefined-global --- selene: allow(undefined_variable) -return { - s("in", { t "interface{}" }), - s({ trig = "err", name = "if err" }, { - t "if err != nil", - t { " {", "\t" }, - i(0), - t { "", "}" }, - }), - s({ trig = "type", name = "type def", decr = "define a type" }, { - t "type ", - i(1, "Name"), - c(2, { - t " struct", - t " interface", - }), - t { " {", "\t" }, - i(0), - t { "", "}" }, - }), - s(":", { - i(1, "name"), - t " := ", - i(2, "value"), - }), -}
D

@@ -1,20 +0,0 @@

----@diagnostic disable: undefined-global --- selene: allow(undefined_variable) -return { - s( - "M", - fmt( - [[local <> = {} - -<> - -return <>]], - { - i(1, "M"), - i(0), - rep(1), - }, - { delimiters = "<>" } - ) - ), -}
M lua/plugins/completion.lua

@@ -32,7 +32,6 @@ "hrsh7th/nvim-cmp",

event = "InsertEnter", dependencies = { "hrsh7th/cmp-buffer", - "saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-path", "hrsh7th/cmp-nvim-lsp", { "zbirenbaum/copilot-cmp", dependencies = "copilot.lua" },

@@ -40,11 +39,10 @@ },

config = function() local cmp = require "cmp" local cmp_autopairs = require "nvim-autopairs.completion.cmp" - local luasnip = require "luasnip" cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) cmp.setup.filetype({ "gitcommit", "NeogitCommitMessage" }, { - sources = { { name = "buffer" }, { name = "luasnip" } }, + sources = { { name = "buffer" } }, }) require("copilot_cmp").setup()

@@ -52,7 +50,7 @@

cmp.setup { snippet = { expand = function(args) - luasnip.lsp_expand(args.body) + vim.snippet.expand(args.body) end, }, window = {},

@@ -103,9 +101,6 @@ },

["<Tab>"] = function(fallback) if cmp.visible() then cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - -- stylua: ignore - vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "") else fallback() end

@@ -113,9 +108,6 @@ end,

["<S-Tab>"] = function(fallback) if cmp.visible() then cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - -- stylua: ignore - vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "") else fallback() end

@@ -125,7 +117,6 @@ sources = cmp.config.sources {

{ name = "copilot", group_index = 2, max_item_count = 3 }, { name = "nvim_lsp", max_item_count = 12 }, { name = "buffer", max_item_count = 4 }, - { name = "luasnip", max_item_count = 3 }, { name = "path", max_item_count = 2 }, }, experimental = { ghost_text = true },
D

@@ -1,50 +0,0 @@

-return { - "L3MON4D3/LuaSnip", - dependencies = { "rafamadriz/friendly-snippets" }, - keys = { - { - "<C-l>", - function() - local ls = require "luasnip" - if ls.choice_active() then - ls.change_choice(1) - elseif ls.expand_or_jumpable() then - ls.expand_or_jump() - end - end, - mode = { "s", "i" }, - }, - }, - config = function() - local ls = require "luasnip" - local types = require "luasnip.util.types" - local fmt = require("luasnip.extras.fmt").fmt - local extras = require "luasnip.extras" - - ls.config.set_config { - history = false, - region_check_events = "CursorMoved,CursorHold,InsertEnter", - delete_check_events = "InsertLeave", - snip_env = { - fmt = fmt, - rep = extras.rep, - m = extras.match, - l = extras.lamda, - s = ls.snippet, - t = ls.text_node, - f = ls.function_node, - c = ls.choice_node, - d = ls.dynamic_node, - i = ls.insert_node, - }, - -- stylua: ignore - ext_opts = { - [types.choiceNode] = { passive = { virt_text = { { "●", "Operator" } }, hl_group = "LuaSnipChoiceNode", }, }, - [types.insertNode] = { active = { virt_text = { { "●", "Type" } }, hl_group = "LuaSnipInsertNode", }, }, - }, - } - - require("luasnip.loaders.from_lua").lazy_load() - require("luasnip.loaders.from_vscode").lazy_load() - end, -}