Files
dotfiles/common/.config/nvim/lua/config/autocmd.lua
Pratik Tripathy dbb0df0c4d fix(nvim): Add autopair plugins for formatting lines when autopaired and
cursor goes to next line, deprecated `vim.highlight` to `vim.hl`

- fix: replaced deprecated `vim.highlight.on_yank` to `vim.hl.on_yank`
2025-07-29 11:38:13 +05:30

28 lines
929 B
Lua

-- Auto reload existing session
if not vim.g.vscode then
vim.api.nvim_create_autocmd("VimEnter", {
group = vim.api.nvim_create_augroup("restore_session", { clear = true }),
callback = function()
-- If nvim started with arguments, do NOT restore
if vim.fn.argc() ~= 0 then
return
end
require("persistence").load()
end,
nested = true,
})
end
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking text",
group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }),
callback = function()
vim.hl.on_yank({
higroup = "Visual", -- Highlight group to use
timeout = 400, -- Duration in milliseconds
on_visual = true, -- Highlight visual selections
on_macro = false, -- Don't highlight during macro playback
})
end,
})