diff --git a/lua/luasnip/config.lua b/lua/luasnip/config.lua index 6b551cc89..c650d1aac 100644 --- a/lua/luasnip/config.lua +++ b/lua/luasnip/config.lua @@ -121,7 +121,9 @@ c = { end) if session.config.enable_autosnippets then ls_autocmd("InsertCharPre", function() - require("luasnip.util.feedkeys").feedkeys_insert("lua require('luasnip').expand_auto()") + require("luasnip.util.feedkeys").feedkeys_insert( + "lua require('luasnip').expand_auto()" + ) end) end diff --git a/lua/luasnip/util/feedkeys.lua b/lua/luasnip/util/feedkeys.lua index c221ae626..a3627954e 100644 --- a/lua/luasnip/util/feedkeys.lua +++ b/lua/luasnip/util/feedkeys.lua @@ -27,7 +27,15 @@ local enqueued_actions = {} local function _feedkeys_insert(id, keys) executing_id = id vim.api.nvim_feedkeys( - vim.api.nvim_replace_termcodes(keys .. "lua require('luasnip.util.feedkeys').confirm(" .. id .. ")", true, false, true), + vim.api.nvim_replace_termcodes( + keys + .. "lua require('luasnip.util.feedkeys').confirm(" + .. id + .. ")", + true, + false, + true + ), -- folds are opened manually now, no need to pass t. -- n prevents langmap from interfering. "ni", @@ -132,9 +140,9 @@ end function M.confirm(id) executing_id = nil - if enqueued_actions[id+1] then - enqueued_actions[id+1](id+1) - enqueued_actions[id+1] = nil + if enqueued_actions[id + 1] then + enqueued_actions[id + 1](id + 1) + enqueued_actions[id + 1] = nil end end diff --git a/tests/integration/session_spec.lua b/tests/integration/session_spec.lua index 4b1887d6a..c48273729 100644 --- a/tests/integration/session_spec.lua +++ b/tests/integration/session_spec.lua @@ -2156,7 +2156,8 @@ describe("session", function() {0:~ }| {0:~ }| {0:~ }| - {2:-- INSERT --recording @a} |]] }) + {2:-- INSERT --recording @a} |]], + }) change() jump() screen:expect({ @@ -2190,7 +2191,8 @@ describe("session", function() {0:~ }| {0:~ }| {0:~ }| - {2:-- INSERT --recording @a} |]] }) + {2:-- INSERT --recording @a} |]], + }) change() feed("aa") jump() @@ -2229,7 +2231,8 @@ describe("session", function() {0:~ }| {0:~ }| {0:~ }| - {2:-- INSERT --recording @a} |]] }) + {2:-- INSERT --recording @a} |]], + }) feed("ccGqo@a") screen:expect({ grid = [[ @@ -2262,6 +2265,7 @@ describe("session", function() {0:~ }| {0:~ }| {0:~ }| - |]] }) + |]], + }) end) end) diff --git a/tests/integration/snippet_basics_spec.lua b/tests/integration/snippet_basics_spec.lua index 90a386950..a5d3e474c 100644 --- a/tests/integration/snippet_basics_spec.lua +++ b/tests/integration/snippet_basics_spec.lua @@ -1653,6 +1653,7 @@ describe("snippets_basic", function() grid = [[ qwer | qwe^r | - |]]}) + |]], + }) end) end)