nvim-config

Log | Files | Refs | Submodules | README

commit 7567ef1aa3deed41ed0cddb95a9a33c79a25c6fe
parent 40229aa884b52b5176e9e8607910f8b773a14b4d
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date:   Fri, 20 May 2022 08:57:46 +0200

fix: update to latest luasnip API

Diffstat:
Mlua/completree-config.lua | 73+++++++++++++++++++++++++++++++++++++------------------------------------
1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/lua/completree-config.lua b/lua/completree-config.lua @@ -1,11 +1,12 @@ -local comp = require"complementree" -local s = require"complementree.sources" -local cdef = require'complementree.defaults' -local cc = require"complementree.combinators" -local ccomp = require'complementree.comparators' -local cf = require'complementree.filters' +local comp = require "complementree" +local s = require "complementree.sources" +local cdef = require 'complementree.defaults' +local cc = require "complementree.combinators" +local ccomp = require 'complementree.comparators' +local cf = require 'complementree.filters' local api = vim.api + local function zest_complete(_, _, preffix, _) local query if preffix and #preffix ~= 0 then @@ -13,7 +14,7 @@ local function zest_complete(_, _, preffix, _) else query = "*" end - local files = vim.fn.systemlist{"zest", "search", query } + local files = vim.fn.systemlist { "zest", "search", query } local ret = {} @@ -31,7 +32,7 @@ end local function md_complete(...) local fullpath = vim.fn.expand "%:p" - if vim.fn.executable'zest' == 1 and #(vim.fn.system{ 'zest', 'search', string.format('file:%s', fullpath)}) ~= 0 then + if vim.fn.executable 'zest' == 1 and #(vim.fn.system { 'zest', 'search', string.format('file:%s', fullpath) }) ~= 0 then cc.wrap(zest_complete)(...) elseif vim.fn.executable "zk" == 1 and vim.startswith(fullpath, vim.fn.expand("$ZK_NOTEBOOK_DIR")) then cc.pipeline(s.lsp_matches {}, ccomp.debug, ccomp.fzy)(...) @@ -118,32 +119,32 @@ local comment_tag = (function() end end)() -local gitcommit_snips = { - s({ trig = "coauth", name = "Co Author", dscr = "A git co-author"}, { - t "Co-authored-by: ", i(1, "name"), t" <", i(2, "email"), t">" - }), - s({ trig = "fix", name = "Fix message", dscr = "Fix without scope or breaking" }, convcommit_snippet"fix"), - s({ trig = "feat", name = "Feature message", dscr = "Feature without scope or breaking" }, convcommit_snippet"feat"), - s({ trig = "chore", name = "Chore change", dscr = "An update or whatever" }, convcommit_snippet "chore") - } +ls.add_snippets('all', { + s("todo", { d(1, comment_tag, {}, "TODO") }), + s("fixme", { d(1, comment_tag, {}, "FIXME") }), +}) -ls.snippets = { - all = { - s("todo", { d(1, comment_tag, {}, "TODO") }), - s("fixme", { d(1, comment_tag, {}, "FIXME") }), - }, - NeogitCommitMessage = gitcommit_snips, - gitcommit = gitcommit_snips, - text = { - s({ trig = "ts", dscr = "Tree-sitter test case"}, { - t { "", "=====================", ""}, - i(1, "Title"), - t{ "", "=====================", "" }, - i(2, "Body"), - t { "", "---------------" } - }) - }, - lua = { - s('lreq', { t 'local ', dl(2, l._1:match '[^.]+$', 1), t " = require'", i(1), t { "'", '' } }), - } -} +ls.add_snippets('gitcommit', { + s({ trig = "coauth", name = "Co Author", dscr = "A git co-author" }, { + t "Co-authored-by: ", i(1, "name"), t " <", i(2, "email"), t ">" + }), + s({ trig = "fix", name = "Fix message", dscr = "Fix without scope or breaking" }, convcommit_snippet "fix"), + s({ trig = "feat", name = "Feature message", dscr = "Feature without scope or breaking" }, convcommit_snippet "feat"), + s({ trig = "chore", name = "Chore change", dscr = "An update or whatever" }, convcommit_snippet "chore") +}) + +ls.filetype_set('NeogitCommitMessage', { 'gitcommit' }) + +ls.add_snippets('text', { + s({ trig = "ts", dscr = "Tree-sitter test case" }, { + t { "", "=====================", "" }, + i(1, "Title"), + t { "", "=====================", "" }, + i(2, "Body"), + t { "", "---------------" } + }) +}) + +ls.add_snippets('lua', { + s('lreq', { t 'local ', dl(2, l._1:match '[^.]+$', 1), t " = require'", i(1), t { "'", '' } }), +})