Skip to content

Commit cb0a76a

Browse files
committed
🚑 Set vim.b.xp only when InsertCharPre
1 parent 237e681 commit cb0a76a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugin/code-stats.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ vim.api.nvim_create_autocmd({ "InsertCharPre" }, {
1111
vim.api.nvim_create_autocmd({ "BufWrite", "BufLeave" }, {
1212
group = augroup_id,
1313
callback = function()
14-
codestats.add_xp(vim.o.filetype, vim.b.xp or 0)
15-
vim.b.xp = 0
14+
if vim.b.xp then
15+
codestats.add_xp(vim.o.filetype, vim.b.xp)
16+
vim.b.xp = 0
17+
end
1618
end,
1719
})
1820
vim.api.nvim_create_autocmd("VimLeavePre", {

0 commit comments

Comments
 (0)