Update markview keyboard shortcut

- Update the keyboard shortcut to imitate Joplin behavior
This commit is contained in:
Max 2024-12-28 20:05:45 +01:00
parent 21336806ff
commit 4812bdd7dc
1 changed files with 31 additions and 28 deletions

View File

@ -19,16 +19,19 @@ return {
config = function(_, opts)
require('markview').setup(opts)
local splitToggle_state = false
-- This function imitates the behavior of Joplin when rendering notes
local splitToggle_state = 0
vim.keymap.set('n', '<C-ö>', function()
if not splitToggle_state then
-- The split toggle will not work unless markview is disabled in the initial window beforehand
vim.cmd 'Markview disableAll'
if splitToggle_state == 0 then
vim.cmd 'Markview enableAll'
splitToggle_state = 1
elseif splitToggle_state == 1 then
vim.cmd 'Markview splitEnable'
splitToggle_state = true
splitToggle_state = 2
else
vim.cmd 'Markview splitDisable'
splitToggle_state = false
vim.cmd 'Markview disableAll'
splitToggle_state = 0
end
end, { silent = true, desc = 'Toggle Markview split view' })
end,