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