diff options
Diffstat (limited to '.vim/lua/internal/snips.lua')
| -rw-r--r-- | .vim/lua/internal/snips.lua | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/.vim/lua/internal/snips.lua b/.vim/lua/internal/snips.lua index 91bce13..bb9fdef 100644 --- a/.vim/lua/internal/snips.lua +++ b/.vim/lua/internal/snips.lua @@ -48,7 +48,7 @@ local comment = function(wrapped, blockcomment) }) local tbl = vim.split(cs or '', '%s', { plain = true, trimempty = true }) return (#tbl == 0) and { '', '' } - or ((#tbl == 1) and { tbl[1] .. ' ', '' } or { tbl[1], tbl[2] }) + or ((#tbl == 1) and { tbl[1] .. ' ', '' } or { tbl[1], tbl[2] }) end if type(wrapped) ~= 'table' then @@ -78,12 +78,12 @@ end local exec = function(command) return ls.f(function(_, _, ...) local results, code = require('plenary.job') - :new({ - command = vim.env.SHELL, - args = { '-c', ... }, - enable_recording = true, - }) - :sync() + :new({ + command = vim.env.SHELL, + args = { '-c', ... }, + enable_recording = true, + }) + :sync() if not code == 0 or #results == 0 then error(string.format('exec "%s" failed', ...)) end @@ -102,6 +102,10 @@ local file_contents = function(path, vargs) end ls.setup({ + history = true, + update_events = 'TextChanged,TextChangedI', + delete_check_events = 'TextChanged', + ext_opts = { [types.snippet] = { active = { @@ -118,13 +122,18 @@ ls.setup({ }, }, }, - snip_env = vim.tbl_extend('keep', ls.session.config.snip_env, { + f = ls.f, + i = ls.i, + s = ls.s, + t = ls.t, + c = ls.c, + sn = ls.sn, + fmt = require('luasnip.extras.fmt').fmt, autowrap = autowrap, exec = exec, comment = comment, file_contents = file_contents, - user_email = { exec([[git config --get user.name]]), ls.t(' <'), @@ -139,7 +148,7 @@ ls.setup({ }) -- snipmate snippets -require('luasnip.loaders.from_snipmate').lazy_load({ paths = './after/snippets' }) +-- require('luasnip.loaders.from_snipmate').lazy_load({ paths = './after/snippets' }) -- lua snippets require('luasnip.loaders.from_lua').lazy_load({ paths = './snippets' }) |