Revert "fix(nvim): do not use cmdheight"

This reverts commit f5dd91d588.
This commit is contained in:
Price Hiller 2022-07-01 10:42:02 -05:00
parent f5dd91d588
commit eca40acae4
2 changed files with 58 additions and 1 deletions

View File

@ -12,6 +12,63 @@ M.setup = function()
vim.api.nvim_create_autocmd('BufWritePre', {
command = '%s/\\s\\+$//e',
})
-- NOTE: Handles issues with cmdheight=0, waiting for
-- NOTE: https://github.com/neovim/neovim/pull/18961
-- NOTE: to be merged
vim.api.nvim_create_autocmd('RecordingEnter', {
pattern = '*',
callback = function()
vim.opt_local.cmdheight = 1
vim.notify('Began Recording Macro', '', { title = 'Macro' })
end,
})
vim.api.nvim_create_autocmd('RecordingLeave', {
pattern = '*',
callback = function(arg)
local timer = vim.loop.new_timer()
-- HACK: Timer is here because we need to close cmdheight AFTER
-- HACK: the macro is ended, not during the RecordingLeave event
timer:start(
50,
0,
vim.schedule_wrap(function()
local cmdheight_status = vim.api.nvim_get_option_value('cmdheight', {})
if cmdheight_status > 0 then
vim.opt_local.cmdheight = 0
vim.notify('Stopped Recording Macro', '', { title = 'Macro' })
end
end)
)
end,
})
vim.api.nvim_create_autocmd('CmdlineEnter', {
pattern = '*',
callback = function()
vim.opt_local.cmdheight = 1
end,
})
vim.api.nvim_create_autocmd('CmdlineLeave', {
pattern = '*',
callback = function()
local timer = vim.loop.new_timer()
-- HACK: Timer is here because we need to close cmdheight AFTER
-- HACK: the macro is ended, not during the RecordingLeave event
timer:start(
50,
0,
vim.schedule_wrap(function()
local cmdheight_status = vim.api.nvim_get_option_value('cmdheight', {})
if cmdheight_status > 0 then
vim.opt_local.cmdheight = 0
end
end)
)
end,
})
end
return M

View File

@ -105,7 +105,7 @@ M.setup = function()
opt.modelines = 5
-- Set command bar height to hide when not in use
opt.cmdheight = 1
opt.cmdheight = 0
-- Disable wrap
opt.wrap = false