Skip to content

Commit

Permalink
Fixed not updating (#6)
Browse files Browse the repository at this point in the history
Sometimes the preview didn't update for me, because the wrong mode was getting detected, providing more modes should fix it
  • Loading branch information
marqmitk authored Feb 23, 2024
1 parent 28749ae commit 150340f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugin/codesnap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ vim.api.nvim_create_user_command("CodeSnapPreviewOn", function()
codesnap.open_preview()
end, {})

local validModes = {
["v"] = true,
["V"] = true,
["^V"] = true,
}
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
callback = function()
local mode = vim.api.nvim_get_mode().mode

if mode ~= "v" or not codesnap.preview_switch then
if not validModes[mode] or not codesnap.preview_switch then
return
end

Expand Down

0 comments on commit 150340f

Please sign in to comment.