mirror of
https://github.com/hyzendust/KickestEnd.nvim.git
synced 2026-02-15 07:41:13 +01:00
Update: Modularizing some features and customizations.
This commit is contained in:
22
lua/message_auto_clear.lua
Normal file
22
lua/message_auto_clear.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
-- Auto-clear command line messages on most user actions and on pressing ESC
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
-- Create an augroup for auto-clearing messages
|
||||
local clear_msg_grp = vim.api.nvim_create_augroup('AutoClearMessages', { clear = true })
|
||||
|
||||
-- Clear messages on common user actions
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI', 'InsertEnter', 'InsertLeave', 'TextChanged', 'TextChangedI' }, {
|
||||
group = clear_msg_grp,
|
||||
callback = function()
|
||||
vim.cmd 'echo ""' -- Clear the message/command line
|
||||
end,
|
||||
})
|
||||
|
||||
-- Clear messages when pressing ESC in normal and visual modes
|
||||
vim.keymap.set('n', '<Esc>', '<Esc><Cmd>echo ""<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('v', '<Esc>', '<Esc><Cmd>echo ""<CR>', { noremap = true, silent = true })
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user