mirror of
https://github.com/mistricky/codesnap.nvim.git
synced 2024-12-27 03:46:29 +00:00
Fixed not updating (#6)
Sometimes the preview didn't update for me, because the wrong mode was getting detected, providing more modes should fix it
This commit is contained in:
parent
28749ae8e9
commit
150340f1a2
1 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue