main
Dominik Madarász 2024-11-11 13:14:16 +01:00
parent d2be3412cc
commit 36b343b213
1 changed files with 33 additions and 18 deletions

View File

@ -143,21 +143,36 @@ vim.keymap.set('n', '<leader>cd', function()
vim.cmd('Ex ' .. config_dir)
end, { desc = 'Jump to Neovim config directory' })
vim.keymap.set('n', '<leader>z', function()
require("zen-mode").toggle({
window = {
width = .65, -- width will be 85% of the editor width
options = {}
},
plugins = {
options = {
enabled = true,
ruler = true, -- disables the ruler text in the cmd line area
showcmd = true, -- disables the command in the last line of the screen
-- you may turn on/off statusline in zen mode by setting 'laststatus'
-- statusline will be shown only if 'laststatus' == 3
laststatus = 3,
}
}
})
end, { desc = 'Zen Mode' })
vim.g.is_maximized = false
vim.g.original_height = 0
vim.g.original_width = 0
function ToggleZen()
if vim.g.is_maximized then
-- Restore original size
if vim.g.original_height > 0 then vim.cmd('resize ' .. vim.g.original_height) end
if vim.g.original_width > 0 then vim.cmd('vertical resize ' .. vim.g.original_width) end
vim.g.is_maximized = false
else
-- Save current dimensions
vim.g.original_height = vim.fn.winheight(0)
vim.g.original_width = vim.fn.winwidth(0)
-- Check if the buffer is a terminal
if vim.bo.buftype == "terminal" then
-- Maximize height only
vim.cmd('resize')
else
-- Maximize both height and width
vim.cmd('resize')
vim.cmd('vertical resize')
end
vim.g.is_maximized = true
end
end
vim.keymap.set('n', '<A-z>', ToggleZen, { desc = 'Zen Mode' })
vim.keymap.set('v', '<A-z>', ToggleZen, { desc = 'Zen Mode' })
vim.keymap.set('i', '<A-z>', ToggleZen, { desc = 'Zen Mode' })
vim.keymap.set('t', '<A-z>', ToggleZen, { desc = 'Zen Mode', silent = true })