refactor(nvim): remove autocmds for cmdheight
Issues autocmds addressed have been fixed in upstream
This commit is contained in:
parent
8b810534f3
commit
b5cff25175
@ -12,63 +12,6 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user