Fixed not updating (#6)
Sometimes the preview didn't update for me, because the wrong mode was getting detected, providing more modes should fix itpull/7/head
parent
28749ae8e9
commit
150340f1a2
|
@ -9,11 +9,16 @@ vim.api.nvim_create_user_command("CodeSnapPreviewOn", function()
|
||||||
codesnap.open_preview()
|
codesnap.open_preview()
|
||||||
end, {})
|
end, {})
|
||||||
|
|
||||||
|
local validModes = {
|
||||||
|
["v"] = true,
|
||||||
|
["V"] = true,
|
||||||
|
["^V"] = true,
|
||||||
|
}
|
||||||
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
|
vim.api.nvim_create_autocmd({ "CursorMoved" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
local mode = vim.api.nvim_get_mode().mode
|
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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue