nvim/lua/zynh/autos.lua

33 lines
789 B
Lua
Raw Normal View History

2023-03-10 14:58:22 +00:00
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
2023-04-07 08:14:43 +00:00
2023-03-10 14:58:22 +00:00
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})
2023-04-07 08:14:43 +00:00
-- vim.cmd [[
-- autocmd TermOpen * startinsert
-- ]]
2023-04-07 09:24:37 +00:00
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter", "WinEnter", "TermOpen" }, {
callback = function()
vim.o.relativenumber = false
vim.o.number = false
vim.cmd.startinsert()
end,
pattern = { "term://*" }
})
vim.api.nvim_create_autocmd({ "BufLeave" }, {
callback = function() vim.cmd.stopinsert() end,
pattern = { "term://*" }
})
vim.api.nvim_create_autocmd({ "TermClose" }, {
callback = function() vim.api.nvim_input("<CR>") end,
2023-04-07 08:14:43 +00:00
})