mirror of
https://github.com/hyzendust/KickestEnd.nvim.git
synced 2026-02-15 05:01:14 +01:00
yank_notification: show line numbers. Clipboard copy notification to have line counts. Fix: Paste clipboard over selection
This commit is contained in:
23
lua/yank_notification.lua
Normal file
23
lua/yank_notification.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local M = {}
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
local content = vim.fn.getreg '"'
|
||||
if not content or content == '' then
|
||||
return
|
||||
end
|
||||
-- Split by newline
|
||||
local lines = vim.split(content, '\n', true)
|
||||
-- Remove trailing empty line if present
|
||||
if lines[#lines] == '' then
|
||||
table.remove(lines, #lines)
|
||||
end
|
||||
local line_count = #lines
|
||||
vim.schedule(function()
|
||||
local plural = line_count == 1 and '' or 's'
|
||||
vim.notify(string.format('Yanked %d line%s', line_count, plural), vim.log.levels.INFO)
|
||||
end)
|
||||
end,
|
||||
})
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user