summaryrefslogtreecommitdiff
path: root/lua/lvim/core
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2022-09-10 19:15:21 +0200
committerkylo252 <[email protected]>2022-09-10 19:15:21 +0200
commit824b2d1ef091f173503ebe537aef15a08085787f (patch)
tree2df8343ca6c0b03d17d5597f6c4e1df5897e2e3f /lua/lvim/core
parent50494d62a99b1d0767f330f66f2df0458d2c5da0 (diff)
parent2519e07423e2f6ce4cbed6483305dcaa5bbabf4e (diff)
Merge remote-tracking branch 'origin/rolling'
Diffstat (limited to 'lua/lvim/core')
-rw-r--r--lua/lvim/core/autocmds.lua14
-rw-r--r--lua/lvim/core/cmp.lua15
2 files changed, 8 insertions, 21 deletions
diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua
index 20716e83..f5c63588 100644
--- a/lua/lvim/core/autocmds.lua
+++ b/lua/lvim/core/autocmds.lua
@@ -155,19 +155,11 @@ end
---@param name string the augroup name
function M.clear_augroup(name)
-- defer the function in case the autocommand is still in-use
- local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = name })
- if not exists then
- Log:debug("ignoring request to clear autocmds from non-existent group " .. name)
- return
- end
+ Log:debug("request to clear autocmds " .. name)
vim.schedule(function()
- local status_ok, _ = xpcall(function()
+ pcall(function()
vim.api.nvim_clear_autocmds { group = name }
- end, debug.traceback)
- if not status_ok then
- Log:warn("problems detected while clearing autocmds from " .. name)
- Log:debug(debug.traceback())
- end
+ end)
end)
end
diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua
index 7b0b0e6e..408691a6 100644
--- a/lua/lvim/core/cmp.lua
+++ b/lua/lvim/core/cmp.lua
@@ -272,20 +272,15 @@ M.config = function()
if is_insert_mode() then -- prevent overwriting brackets
confirm_opts.behavior = cmp.ConfirmBehavior.Insert
end
- cmp.confirm(confirm_opts)
- if jumpable(1) then
- luasnip.jump(1)
+ if cmp.confirm(confirm_opts) then
+ return -- success, exit early
end
- return
end
- if jumpable(1) then
- if not luasnip.jump(1) then
- fallback()
- end
- else
- fallback()
+ if jumpable(1) and luasnip.jump(1) then
+ return -- success, exit early
end
+ fallback() -- if not exited early, always fallback
end),
},
}